blob: fb5d600f11483ed7f882de6b3251565578b1531d [file] [log] [blame]
Chris Lattnera1040192003-03-05 21:34:35 +00001; 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 Gohmanf2f6ce62009-09-11 18:01:28 +00005; RUN: opt < %s -simplifycfg -S | not grep N:
Chris Lattnera1040192003-03-05 21:34:35 +00006;
7
Dan Gohmana8ab8932008-03-11 21:47:57 +00008declare i1 @foo()
9
Dan Gohman43ca31e2008-03-11 02:19:59 +000010define i32 @test(i1 %a, i1 %b) {
Dan Gohmana8ab8932008-03-11 21:47:57 +000011 %c = call i1 @foo()
12 br i1 %c, label %N, label %P
13P:
14 %d = call i1 @foo()
15 br i1 %d, label %N, label %Q
Chris Lattnera1040192003-03-05 21:34:35 +000016Q:
17 br label %N
18N:
Dan Gohmana8ab8932008-03-11 21:47:57 +000019 %W = phi i32 [0, %0], [1, %Q], [2, %P]
Chris Lattnera1040192003-03-05 21:34:35 +000020 ; This block should be foldable into M
21 br label %M
22
23M:
Dan Gohman43ca31e2008-03-11 02:19:59 +000024 %R = add i32 %W, 1
25 ret i32 %R
Chris Lattnera1040192003-03-05 21:34:35 +000026}
27