1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; Test merging of blocks that only have PHI nodes in them. This tests the case
3 ; where the mergedinto block doesn't have any PHI nodes, and is in fact
4 ; dominated by the block-to-be-eliminated
6 ; RUN: opt < %s -simplifycfg -simplifycfg-require-and-preserve-domtree=1 -S | FileCheck %s
11 define i32 @test(i1 %a, i1 %b) {
13 ; CHECK-NEXT: [[C:%.*]] = call i1 @foo()
14 ; CHECK-NEXT: br i1 [[C]], label [[M:%.*]], label [[P:%.*]]
16 ; CHECK-NEXT: [[D:%.*]] = call i1 @foo()
17 ; CHECK-NEXT: [[SPEC_SELECT:%.*]] = select i1 [[D]], i32 2, i32 1
18 ; CHECK-NEXT: br label [[M]]
20 ; CHECK-NEXT: [[W:%.*]] = phi i32 [ 0, [[TMP0:%.*]] ], [ [[SPEC_SELECT]], [[P]] ]
21 ; CHECK-NEXT: [[R:%.*]] = add i32 [[W]], 1
22 ; CHECK-NEXT: ret i32 [[R]]
25 br i1 %c, label %N, label %P
28 br i1 %d, label %N, label %Q
32 %W = phi i32 [0, %0], [1, %Q], [2, %P]
33 ; This block should be foldable into M