1; RUN: opt -S -inline %s -debug-only=inline-cost 2>&1 | FileCheck %s 2; REQUIRES: asserts 3; Only the load and ret should be included in the instruction count, not 4; the instructions feeding the assume. 5; CHECK: NumInstructions: 2 6 7@a = global i32 4 8 9define i32 @inner(i8* %y) { 10 %a1 = load volatile i32, i32* @a 11 12 ; Because these instructions are used only by the @llvm.assume intrinsic, 13 ; they're free and should not be included in the instruction count when 14 ; computing the inline cost. 15 %a2 = mul i32 %a1, %a1 16 %a3 = sub i32 %a1, %a2 17 %a4 = udiv i32 %a3, -13 18 %a5 = mul i32 %a4, %a4 19 %a6 = add i32 %a5, %a5 20 %ca = icmp sgt i32 %a6, -7 21 %r = call i1 @llvm.type.test(i8* %y, metadata !0) 22 %ca2 = icmp eq i1 %ca, %r 23 tail call void @llvm.assume(i1 %ca2) 24 25 ret i32 %a1 26} 27 28define i32 @outer(i8* %y) optsize { 29 %r = call i32 @inner(i8* %y) 30 ret i32 %r 31} 32 33declare void @llvm.assume(i1) nounwind 34declare i1 @llvm.type.test(i8*, metadata) nounwind readnone 35 36!0 = !{i32 0, !"typeid1"} 37