| Eric Christopher | cee313d | 2019-04-17 04:52:47 +0000 | [diff] [blame] | 1 | ; Test merging of blocks that only have PHI nodes in them. This tests the case |
| 2 | ; where the mergedinto block doesn't have any PHI nodes, and is in fact |
| 3 | ; dominated by the block-to-be-eliminated |
| 4 | ; |
| 5 | ; RUN: opt < %s -simplifycfg -S | not grep N: |
| 6 | ; |
| 7 | |
| 8 | declare i1 @foo() |
| 9 | |
| 10 | define i32 @test(i1 %a, i1 %b) { |
| 11 | %c = call i1 @foo() |
| 12 | br i1 %c, label %N, label %P |
| 13 | P: |
| 14 | %d = call i1 @foo() |
| 15 | br i1 %d, label %N, label %Q |
| 16 | Q: |
| 17 | br label %N |
| 18 | N: |
| 19 | %W = phi i32 [0, %0], [1, %Q], [2, %P] |
| 20 | ; This block should be foldable into M |
| 21 | br label %M |
| 22 | |
| 23 | M: |
| 24 | %R = add i32 %W, 1 |
| 25 | ret i32 %R |
| 26 | } |
| 27 | |