1 ; RUN: opt < %s -S -ipsccp | FileCheck %s
3 ; After the first round of Solver.Solve(), the return value of @testf still
4 ; undefined as we hit a branch on undef. Therefore the conditional branch on
5 ; @testf's return value in @bar is unknown. In ResolvedUndefsIn, we force the
6 ; false branch to be feasible. We later discover that @testf actually
7 ; returns true, so we end up with an unfolded "br i1 true".
10 ; CHECK-LABEL: if.then:
11 ; CHECK: [[CALL:%.+]] = call i1 @testf()
12 ; CHECK-NEXT: br i1 true, label %if.end, label %if.then
16 if.then: ; preds = %entry, %if.then
17 %foo = phi i32 [ 0, %entry], [ %next, %if.then]
18 %next = add i32 %foo, 1
19 %call = call i1 @testf()
20 br i1 %call, label %if.end, label %if.then
22 if.end: ; preds = %if.then, %entry
26 define internal i1 @testf() {
27 ; CHECK-LABEL: define internal i1 @testf(
29 ; CHECK-NEXT: br label [[IF_END3:%.*]]
31 ; CHECK-NEXT: ret i1 undef
34 br i1 undef, label %if.then1, label %if.end3
36 if.then1: ; preds = %if.end
39 if.end3: ; preds = %if.then1, %entry
44 ; Call sites in unreachable blocks should not be a problem.
45 ; CHECK-LABEL: define i1 @test2() {
47 ; CHECK-NEXT: br label %if.end
48 ; CHECK-LABEL: if.end: ; preds = %entry
49 ; CHECK-NEXT: %call2 = call i1 @testf()
50 ; CHECK-NEXT: ret i1 true
55 if.then: ; preds = %entry, %if.then
56 %call = call i1 @testf()
57 br i1 %call, label %if.end, label %if.then
59 if.end: ; preds = %if.then, %entry
60 %call2 = call i1 @testf()