1; RUN: opt < %s -S -ipsccp | FileCheck %s
2
3target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
4target triple = "x86_64-unknown-linux-gnu"
5
6define i64 @fn2() {
7entry:
8  %conv = sext i32 undef to i64
9  %div = sdiv i64 8, %conv
10  %call2 = call i64 @fn1(i64 %div)
11  ret i64 %call2
12}
13
14; CHECK-DAG: define i64 @fn2(
15; CHECK: %[[CALL:.*]] = call i64 @fn1(i64 undef)
16
17define internal i64 @fn1(i64 %p1) {
18entry:
19  %tobool = icmp ne i64 %p1, 0
20  %cond = select i1 %tobool, i64 %p1, i64 %p1
21  ret i64 %cond
22}
23
24; CHECK-DAG: define internal i64 @fn1(
25; CHECK: %[[SEL:.*]] = select i1 undef, i64 undef, i64 undef
26; CHECK: ret i64 %[[SEL]]
27