| 26 | } |
| 27 | |
| 28 | TEST(BasicBlockUtils, SplitBlockPredecessors) { |
| 29 | LLVMContext C; |
| 30 | |
| 31 | std::unique_ptr<Module> M = parseIR( |
| 32 | C, |
| 33 | "define i32 @basic_func(i1 %cond) {\n" |
| 34 | "entry:\n" |
| 35 | " br i1 %cond, label %bb0, label %bb1\n" |
| 36 | "bb0:\n" |
| 37 | " br label %bb1\n" |
| 38 | "bb1:\n" |
| 39 | " %phi = phi i32 [ 0, %entry ], [ 1, %bb0 ]" |
| 40 | " ret i32 %phi\n" |
| 41 | "}\n" |
| 42 | "\n" |
| 43 | ); |
| 44 | |
| 45 | auto *F = M->getFunction("basic_func"); |
| 46 | DominatorTree DT(*F); |
| 47 | |
| 48 | // Make sure the dominator tree is properly updated if calling this on the |
| 49 | // entry block. |
| 50 | SplitBlockPredecessors(&F->getEntryBlock(), {}, "split.entry", &DT); |
| 51 | EXPECT_TRUE(DT.verify()); |
| 52 | } |
nothing calls this directly
no test coverage detected