1; RUN: opt < %s -S -ipsccp | FileCheck %s
2target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
3target triple = "x86_64-unknown-linux-gnu"
4
5define void @fn2() {
6entry:
7  br label %if.end
8
9for.cond1:                                        ; preds = %if.end, %for.end
10  br i1 undef, label %if.end, label %if.end
11
12if.end:                                           ; preds = %lbl, %for.cond1
13  %e.2 = phi i32* [ undef, %entry ], [ null, %for.cond1 ], [ null, %for.cond1 ]
14  %0 = load i32, i32* %e.2, align 4
15  %call = call i32 @fn1(i32 %0)
16  br label %for.cond1
17}
18
19define internal i32 @fn1(i32 %p1) {
20entry:
21  %tobool = icmp ne i32 %p1, 0
22  %cond = select i1 %tobool, i32 %p1, i32 %p1
23  ret i32 %cond
24}
25
26; CHECK-LABEL: define void @fn2(
27; CHECK: call i32 @fn1(i32 undef)
28
29; CHECK-LABEL: define internal i32 @fn1(
30; CHECK:%[[COND:.*]] = select i1 undef, i32 undef, i32 undef
31; CHECK: ret i32 %[[COND]]
32