1 ; RUN: opt -ipsccp -S %s | FileCheck %s
3 %struct.S = type { i32 }
7 ; CHECK-LABEL: void @main() {
8 ; CHECK-NEXT: %r = call i32 @f(%struct.S { i32 100 })
9 ; CHECK-NEXT: call void @do_report(i32 123)
10 %r = call i32 @f(%struct.S { i32 100 })
11 call void @do_report(i32 %r)
15 declare void @do_report(i32)
17 define internal i32 @f(%struct.S %s.coerce) {
18 ; CHECK-LABEL: define internal i32 @f(%struct.S %s.coerce)
20 ; CHECK-NEXT: %call = call i8 @lsh(i8 1, i32 100)
21 ; CHECK-LABEL: if.end:
22 ; CHECK-NEXT: ret i32 undef
24 %ev = extractvalue %struct.S %s.coerce, 0
25 %call = call i8 @lsh(i8 1, i32 %ev)
26 %tobool = icmp ne i8 %call, 0
27 br i1 %tobool, label %for.cond, label %if.end
29 for.cond: ; preds = %for.cond, %if.then
30 %i.0 = phi i32 [ 0, %entry], [ %inc, %for.cond ]
31 %cmp = icmp slt i32 %i.0, 1
32 %inc = add nsw i32 %i.0, 1
33 br i1 %cmp, label %for.cond, label %if.end
35 if.end: ; preds = %for.cond, %entry
39 define internal i8 @lsh(i8 %l, i32 %r) {
41 %conv = sext i8 %l to i32
42 %cmp = icmp slt i32 %conv, 0
43 %shr = ashr i32 127, %r
44 %cmp4 = icmp sgt i32 %conv, %shr
45 %or.cond13 = or i1 %cmp, %cmp4
46 %cond = select i1 %or.cond13, i32 %conv, i32 0
47 %conv7 = trunc i32 %cond to i8