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