blob: 5129f9fb6d2f63cc5fa52352fe4b20819fc2d194 [file] [log] [blame]
Dan Gohmanac979882009-10-30 23:16:10 +00001; RUN: opt < %s -instcombine -simplifycfg -S | grep { = phi } | count 1
2
3; instcombine should sort the PHI operands so that simplifycfg can see the
4; duplicate and remove it.
5
6define i32 @foo(i1 %t) {
7entry:
8 call void @bar()
Chris Lattner88a71392009-12-30 05:54:51 +00009 br i1 %t, label %true, label %false
Dan Gohmanac979882009-10-30 23:16:10 +000010true:
11 call void @bar()
12 br label %false
13false:
14 %a = phi i32 [ 2, %true ], [ 5, %entry ]
15 %b = phi i32 [ 5, %entry ], [ 2, %true ]
16 call void @bar()
17 %c = add i32 %a, %b
18 ret i32 %c
19}
20
21declare void @bar()