blob: fb5d600f11483ed7f882de6b3251565578b1531d [file] [log] [blame]
Dan Gohmanf17a25c2007-07-18 16:29:46 +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 Gohman3c7d3082009-09-11 18:01:28 +00005; RUN: opt < %s -simplifycfg -S | not grep N:
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006;
7
Dan Gohman3c04f5c2008-03-11 21:47:57 +00008declare i1 @foo()
9
Dan Gohmanf934d4b2008-03-11 02:19:59 +000010define i32 @test(i1 %a, i1 %b) {
Dan Gohman3c04f5c2008-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
Dan Gohmanf17a25c2007-07-18 16:29:46 +000016Q:
17 br label %N
18N:
Dan Gohman3c04f5c2008-03-11 21:47:57 +000019 %W = phi i32 [0, %0], [1, %Q], [2, %P]
Dan Gohmanf17a25c2007-07-18 16:29:46 +000020 ; This block should be foldable into M
21 br label %M
22
23M:
Dan Gohmanf934d4b2008-03-11 02:19:59 +000024 %R = add i32 %W, 1
25 ret i32 %R
Dan Gohmanf17a25c2007-07-18 16:29:46 +000026}
27