1; RUN: opt < %s -jump-threading -mem2reg -instcombine -simplifycfg  -S | FileCheck %s
2
3declare i32 @f1()
4declare i32 @f2()
5declare void @f3()
6
7define i32 @test(i1 %cond, i1 %cond2) {
8; CHECK: test
9	br i1 %cond, label %T1, label %F1
10
11; CHECK-NOT: T1
12T1:
13	%v1 = call i32 @f1()
14	br label %Merge
15
16F1:
17	%v2 = call i32 @f2()
18	br label %Merge
19
20Merge:
21; CHECK: Merge:
22; CHECK: %v1 = call i32 @f1()
23; CHECK-NEXT: br i1 %cond2
24	%A = phi i1 [true, %T1], [false, %F1]
25	%B = phi i32 [%v1, %T1], [%v2, %F1]
26	%C = and i1 %A, %cond2
27	br i1 %C, label %T2, label %F2
28
29T2:
30	call void @f3()
31	ret i32 %B
32
33F2:
34	ret i32 %B
35}
36