| Chris Lattner | 9115973 | 2003-03-05 21:34:35 +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 | 1880092 | 2009-09-11 18:01:28 +0000 | [diff] [blame] | 5 | ; RUN: opt < %s -simplifycfg -S | not grep N: | 
| Chris Lattner | 9115973 | 2003-03-05 21:34:35 +0000 | [diff] [blame] | 6 | ; | 
|  | 7 |  | 
| Dan Gohman | 8e9ae96 | 2008-03-11 21:47:57 +0000 | [diff] [blame] | 8 | declare i1 @foo() | 
|  | 9 |  | 
| Dan Gohman | 319234d6 | 2008-03-11 02:19:59 +0000 | [diff] [blame] | 10 | define i32 @test(i1 %a, i1 %b) { | 
| Dan Gohman | 8e9ae96 | 2008-03-11 21:47:57 +0000 | [diff] [blame] | 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 | 
| Chris Lattner | 9115973 | 2003-03-05 21:34:35 +0000 | [diff] [blame] | 16 | Q: | 
|  | 17 | br label %N | 
|  | 18 | N: | 
| Dan Gohman | 8e9ae96 | 2008-03-11 21:47:57 +0000 | [diff] [blame] | 19 | %W = phi i32 [0, %0], [1, %Q], [2, %P] | 
| Chris Lattner | 9115973 | 2003-03-05 21:34:35 +0000 | [diff] [blame] | 20 | ; This block should be foldable into M | 
|  | 21 | br label %M | 
|  | 22 |  | 
|  | 23 | M: | 
| Dan Gohman | 319234d6 | 2008-03-11 02:19:59 +0000 | [diff] [blame] | 24 | %R = add i32 %W, 1 | 
|  | 25 | ret i32 %R | 
| Chris Lattner | 9115973 | 2003-03-05 21:34:35 +0000 | [diff] [blame] | 26 | } | 
|  | 27 |  |