OSDN Git Service

72e90aefa6115fcbd065fa53f779ec718891521d
[android-x86/external-llvm.git] / test / Transforms / Inline / optimization-remarks.ll
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-prefix=CHECK -check-prefix=NO_HOTNESS %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-prefix=CHECK -check-prefix=HOTNESS %s
7
8 ; RUN: opt < %s -passes=inline -pass-remarks=inline -pass-remarks-missed=inline \
9 ; RUN:       -pass-remarks-analysis=inline -S 2>&1 | \
10 ; RUN:       FileCheck -check-prefix=CHECK -check-prefix=NO_HOTNESS %s
11 ; RUN: opt < %s -passes=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-prefix=CHECK -check-prefix=HOTNESS %s
14
15 ; HOTNESS: fox will not be inlined into bar because its definition is unavailable
16 ; NO_HOTNESS-NOT: fox will not be inlined into bar because its definition is unavailable
17 ; CHECK: foo inlined into bar with (cost=always): always inline attribute
18 ; CHECK: foz not inlined into bar because it should never be inlined (cost=never): noinline function attribute
19
20 ; Function Attrs: alwaysinline nounwind uwtable
21 define i32 @foo(i32 %x, i32 %y) #0 !prof !1 {
22 entry:
23   %x.addr = alloca i32, align 4
24   %y.addr = alloca i32, align 4
25   store i32 %x, i32* %x.addr, align 4
26   store i32 %y, i32* %y.addr, align 4
27   %0 = load i32, i32* %x.addr, align 4
28   %1 = load i32, i32* %y.addr, align 4
29   %add = add nsw i32 %0, %1
30   ret i32 %add
31 }
32
33 ; Function Attrs: noinline nounwind uwtable
34 define float @foz(i32 %x, i32 %y) #1 !prof !1 {
35 entry:
36   %x.addr = alloca i32, align 4
37   %y.addr = alloca i32, align 4
38   store i32 %x, i32* %x.addr, align 4
39   store i32 %y, i32* %y.addr, align 4
40   %0 = load i32, i32* %x.addr, align 4
41   %1 = load i32, i32* %y.addr, align 4
42   %mul = mul nsw i32 %0, %1
43   %conv = sitofp i32 %mul to float
44   ret float %conv
45 }
46
47 declare i32 @fox()
48
49 ; Function Attrs: nounwind uwtable
50 define i32 @bar(i32 %j) #2 !prof !1 {
51 entry:
52   %j.addr = alloca i32, align 4
53   store i32 %j, i32* %j.addr, align 4
54   %0 = load i32, i32* %j.addr, align 4
55   %1 = load i32, i32* %j.addr, align 4
56   %sub = sub nsw i32 %1, 2
57   %call = call i32 @foo(i32 %0, i32 %sub)
58   %conv = sitofp i32 %call to float
59   %2 = load i32, i32* %j.addr, align 4
60   %sub1 = sub nsw i32 %2, 2
61   %3 = load i32, i32* %j.addr, align 4
62   %call2 = call float @foz(i32 %sub1, i32 %3)
63   %mul = fmul float %conv, %call2
64   %conv3 = fptosi float %mul to i32
65   %call3 = call i32 @fox()
66   %add = add i32 %conv3, %call 
67   ret i32 %add
68 }
69
70 attributes #0 = { alwaysinline nounwind uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
71 attributes #1 = { noinline nounwind uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
72 attributes #2 = { nounwind uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
73
74 !llvm.ident = !{!0}
75
76 !0 = !{!"clang version 3.5.0 "}
77 !1 = !{!"function_entry_count", i64 10}