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