blob: a1e5113980047372ce634a7265493c4b30e262b2 [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()
9 br i1 %t, label %true, label %false,
10true:
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()