blob: 4788406fc0f3e7f5120dc35d9cbe1767a7cec22f [file] [log] [blame]
Eric Christophercee313d2019-04-17 04:52:47 +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()