; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; There should be no phi nodes left.
; RUN: opt -S -passes=jump-threading < %s | FileCheck %s
declare i32 @f1()
declare i32 @f2()
declare void @f3()
define i32 @test(i1 %cond) {
; CHECK-LABEL: @test(
; CHECK-NEXT: br i1 [[COND:%.*]], label [[MERGE:%.*]], label [[MERGE_THREAD:%.*]]
; CHECK: Merge.thread:
; CHECK-NEXT: [[V2:%.*]] = call i32 @f2()
; CHECK-NEXT: br label [[T2:%.*]]
; CHECK: Merge:
; CHECK-NEXT: [[V1:%.*]] = call i32 @f1()
; CHECK-NEXT: [[A:%.*]] = icmp ne i32 [[V1]], 42
; CHECK-NEXT: br i1 [[A]], label [[T2]], label [[F2:%.*]]
; CHECK: T2:
; CHECK-NEXT: call void @f3()
; CHECK-NEXT: ret i32 1
; CHECK: F2:
; CHECK-NEXT: ret i32 0
;
br i1 %cond, label %T1, label %F1
T1:
%v1 = call i32 @f1()
br label %Merge
F1:
%v2 = call i32 @f2()
br label %Merge
Merge:
%B = phi i32 [%v1, %T1], [12, %F1]
%A = icmp ne i32 %B, 42
br i1 %A, label %T2, label %F2
T2:
call void @f3()
ret i32 1
F2:
ret i32 0
}