[RS4GC] Fix rematerialization of bitcast of bitcast.
[oota-llvm.git] / test / Transforms / Inline / optimization-remarks.ll
1 ; RUN: opt < %s -inline -pass-remarks=inline -pass-remarks-missed=inline -pass-remarks-analysis=inline -S 2>&1 | FileCheck %s
2
3 ; CHECK: foo should always be inlined (cost=always)
4 ; CHECK: foo inlined into bar
5 ; CHECK: foz should never be inlined (cost=never)
6 ; CHECK: foz will not be inlined into bar
7
8 ; Function Attrs: alwaysinline nounwind uwtable
9 define i32 @foo(i32 %x, i32 %y) #0 {
10 entry:
11   %x.addr = alloca i32, align 4
12   %y.addr = alloca i32, align 4
13   store i32 %x, i32* %x.addr, align 4
14   store i32 %y, i32* %y.addr, align 4
15   %0 = load i32, i32* %x.addr, align 4
16   %1 = load i32, i32* %y.addr, align 4
17   %add = add nsw i32 %0, %1
18   ret i32 %add
19 }
20
21 ; Function Attrs: noinline nounwind uwtable
22 define float @foz(i32 %x, i32 %y) #1 {
23 entry:
24   %x.addr = alloca i32, align 4
25   %y.addr = alloca i32, align 4
26   store i32 %x, i32* %x.addr, align 4
27   store i32 %y, i32* %y.addr, align 4
28   %0 = load i32, i32* %x.addr, align 4
29   %1 = load i32, i32* %y.addr, align 4
30   %mul = mul nsw i32 %0, %1
31   %conv = sitofp i32 %mul to float
32   ret float %conv
33 }
34
35 ; Function Attrs: nounwind uwtable
36 define i32 @bar(i32 %j) #2 {
37 entry:
38   %j.addr = alloca i32, align 4
39   store i32 %j, i32* %j.addr, align 4
40   %0 = load i32, i32* %j.addr, align 4
41   %1 = load i32, i32* %j.addr, align 4
42   %sub = sub nsw i32 %1, 2
43   %call = call i32 @foo(i32 %0, i32 %sub)
44   %conv = sitofp i32 %call to float
45   %2 = load i32, i32* %j.addr, align 4
46   %sub1 = sub nsw i32 %2, 2
47   %3 = load i32, i32* %j.addr, align 4
48   %call2 = call float @foz(i32 %sub1, i32 %3)
49   %mul = fmul float %conv, %call2
50   %conv3 = fptosi float %mul to i32
51   ret i32 %conv3
52 }
53
54 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" }
55 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" }
56 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" }
57
58 !llvm.ident = !{!0}
59
60 !0 = !{!"clang version 3.5.0 "}