Dan Gohman | f17a25c | 2007-07-18 16:29:46 +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 | ; |
Dan Gohman | f934d4b | 2008-03-11 02:19:59 +0000 | [diff] [blame^] | 5 | ; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | not grep N: |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6 | ; |
| 7 | |
Dan Gohman | f934d4b | 2008-03-11 02:19:59 +0000 | [diff] [blame^] | 8 | define i32 @test(i1 %a, i1 %b) { |
| 9 | br i1 %b, label %N, label %Q |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 10 | Q: |
| 11 | br label %N |
| 12 | N: |
Dan Gohman | f934d4b | 2008-03-11 02:19:59 +0000 | [diff] [blame^] | 13 | %W = phi i32 [0, %0], [1, %Q] |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 14 | ; This block should be foldable into M |
| 15 | br label %M |
| 16 | |
| 17 | M: |
Dan Gohman | f934d4b | 2008-03-11 02:19:59 +0000 | [diff] [blame^] | 18 | %R = add i32 %W, 1 |
| 19 | ret i32 %R |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 20 | } |
| 21 | |