blob: 58ca17700ee3332c27c614b387ef6ffce791e04c [file] [log] [blame]
Dan Gohman5bb7c7c2009-09-08 22:34:10 +00001; RUN: opt %s -jump-threading -mem2reg -instcombine -simplifycfg -S | grep {ret i32 %v1}
Chris Lattnerdfdff6c2008-04-22 20:46:09 +00002; There should be no uncond branches left.
Dan Gohman5bb7c7c2009-09-08 22:34:10 +00003; RUN: opt %s -jump-threading -mem2reg -instcombine -simplifycfg -S | not grep {br label}
Chris Lattnerdfdff6c2008-04-22 20:46:09 +00004
5declare i32 @f1()
6declare i32 @f2()
7declare void @f3()
8
9define i32 @test(i1 %cond, i1 %cond2, i1 %cond3) {
10 br i1 %cond, label %T1, label %F1
11
12T1:
13 %v1 = call i32 @f1()
14 br label %Merge
15
16F1:
17 %v2 = call i32 @f2()
18 br label %Merge
19
20Merge:
21 %A = phi i1 [true, %T1], [false, %F1]
22 %B = phi i32 [%v1, %T1], [%v2, %F1]
23 %C = and i1 %A, %cond2
24 %D = and i1 %C, %cond3
25 br i1 %D, label %T2, label %F2
26
27T2:
28 call void @f3()
29 ret i32 %B
30
31F2:
32 ret i32 %B
33}