1 ; RUN: opt < %s -inline -pass-remarks=inline -pass-remarks-missed=inline \
2 ; RUN: -pass-remarks-analysis=inline -S 2>&1 | \
3 ; RUN: FileCheck -check-prefixes=CHECK,NO_HOTNESS,ALWAYS %s
4 ; RUN: opt < %s -inline -pass-remarks=inline -pass-remarks-missed=inline \
5 ; RUN: -pass-remarks-analysis=inline -pass-remarks-with-hotness -S 2>&1 | \
6 ; RUN: FileCheck -check-prefixes=CHECK,HOTNESS,ALWAYS %s
8 ; RUN: opt < %s -passes=always-inline -pass-remarks=inline -pass-remarks-missed=inline \
9 ; RUN: -pass-remarks-analysis=inline -S 2>&1 | \
10 ; RUN: FileCheck -check-prefixes=ALWAYS %s
11 ; RUN: opt < %s -passes=always-inline -pass-remarks=inline -pass-remarks-missed=inline \
12 ; RUN: -pass-remarks-analysis=inline -pass-remarks-with-hotness -S 2>&1 | \
13 ; RUN: FileCheck -check-prefixes=ALWAYS %s
15 ; RUN: opt < %s -passes=inline -pass-remarks=inline -pass-remarks-missed=inline \
16 ; RUN: -pass-remarks-analysis=inline -S 2>&1 | \
17 ; RUN: FileCheck -check-prefixes=CHECK,NO_HOTNESS,ALWAYS %s
18 ; RUN: opt < %s -passes=inline -pass-remarks=inline -pass-remarks-missed=inline \
19 ; RUN: -pass-remarks-analysis=inline -pass-remarks-with-hotness -S 2>&1 | \
20 ; RUN: FileCheck -check-prefixes=CHECK,HOTNESS,ALWAYS %s
22 ; RUN: opt < %s -passes=inliner-wrapper-no-mandatory-first -pass-remarks=inline -pass-remarks-missed=inline \
23 ; RUN: -pass-remarks-analysis=inline -S 2>&1 | \
24 ; RUN: FileCheck -check-prefixes=CHECK,NO_HOTNESS,ALWAYS %s
25 ; RUN: opt < %s -passes=inliner-wrapper-no-mandatory-first -pass-remarks=inline -pass-remarks-missed=inline \
26 ; RUN: -pass-remarks-analysis=inline -pass-remarks-with-hotness -S 2>&1 | \
27 ; RUN: FileCheck -check-prefixes=CHECK,HOTNESS,ALWAYS %s
29 ; HOTNESS-DAG: fox will not be inlined into bar because its definition is unavailable
30 ; NO_HOTNESS-NOT: fox will not be inlined into bar because its definition is unavailable
31 ; ALWAYS-DAG: 'foo' inlined into 'bar' with (cost=always): always inline attribute
32 ; CHECK-DAG: 'foz' not inlined into 'bar' because it should never be inlined (cost=never): noinline function attribute
34 ; Function Attrs: alwaysinline nounwind uwtable
35 define i32 @foo(i32 %x, i32 %y) #0 !prof !1 {
37 %x.addr = alloca i32, align 4
38 %y.addr = alloca i32, align 4
39 store i32 %x, i32* %x.addr, align 4
40 store i32 %y, i32* %y.addr, align 4
41 %0 = load i32, i32* %x.addr, align 4
42 %1 = load i32, i32* %y.addr, align 4
43 %add = add nsw i32 %0, %1
47 ; Function Attrs: noinline nounwind uwtable
48 define float @foz(i32 %x, i32 %y) #1 !prof !1 {
50 %x.addr = alloca i32, align 4
51 %y.addr = alloca i32, align 4
52 store i32 %x, i32* %x.addr, align 4
53 store i32 %y, i32* %y.addr, align 4
54 %0 = load i32, i32* %x.addr, align 4
55 %1 = load i32, i32* %y.addr, align 4
56 %mul = mul nsw i32 %0, %1
57 %conv = sitofp i32 %mul to float
63 ; Function Attrs: nounwind uwtable
64 define i32 @bar(i32 %j) #2 !prof !1 {
66 %j.addr = alloca i32, align 4
67 store i32 %j, i32* %j.addr, align 4
68 %0 = load i32, i32* %j.addr, align 4
69 %1 = load i32, i32* %j.addr, align 4
70 %sub = sub nsw i32 %1, 2
71 %call = call i32 @foo(i32 %0, i32 %sub)
72 %conv = sitofp i32 %call to float
73 %2 = load i32, i32* %j.addr, align 4
74 %sub1 = sub nsw i32 %2, 2
75 %3 = load i32, i32* %j.addr, align 4
76 %call2 = call float @foz(i32 %sub1, i32 %3)
77 %mul = fmul float %conv, %call2
78 %conv3 = fptosi float %mul to i32
79 %call3 = call i32 @fox()
80 %add = add i32 %conv3, %call
84 attributes #0 = { alwaysinline nounwind uwtable "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
85 attributes #1 = { noinline nounwind uwtable "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
86 attributes #2 = { nounwind uwtable "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
90 !0 = !{!"clang version 3.5.0 "}
91 !1 = !{!"function_entry_count", i64 10}