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