1; RUN: opt -ipsccp -S %s | FileCheck %s 2 3%struct.S = type { i32 } 4 5 6define void @main() { 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) 12 ret void 13} 14 15declare void @do_report(i32) 16 17define internal i32 @f(%struct.S %s.coerce) { 18; CHECK-LABEL: define internal i32 @f(%struct.S %s.coerce) 19; CHECK-LABEL: entry: 20; CHECK-NEXT: %call = call i8 @lsh(i8 1, i32 100) 21; CHECK-LABEL: if.end: 22; CHECK-NEXT: ret i32 undef 23entry: 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 28 29for.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 34 35if.end: ; preds = %for.cond, %entry 36 ret i32 123 37} 38 39define internal i8 @lsh(i8 %l, i32 %r) { 40entry: 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 48 ret i8 %conv7 49} 50