xref: /llvm-project/llvm/test/Transforms/Inline/inline-threshold.ll (revision 151602c7a9935558ca671b35359989b261045db0)
1; Test that -inline-threshold overrides thresholds derived from opt levels.
2; RUN: opt < %s -O2 -inline-threshold=500 -S  | FileCheck %s
3; RUN: opt < %s -O3 -inline-threshold=500 -S  | FileCheck %s
4; RUN: opt < %s -Os -inline-threshold=500 -S  | FileCheck %s
5; RUN: opt < %s -Oz -inline-threshold=500 -S  | FileCheck %s
6
7@a = global i32 4
8
9define i32 @simpleFunction(i32 %a) #0 {
10entry:
11  %a1 = load volatile i32, ptr @a
12  %x1 = add i32 %a1,  %a
13  ret i32 %x1
14}
15
16; Function Attrs: nounwind readnone uwtable
17define i32 @bar(i32 %a) #0 {
18; CHECK-LABEL: @bar
19; CHECK: load volatile
20; CHECK-NEXT: add i32
21; CHECK-NEXT: call i32 @simpleFunction
22; CHECK: ret
23entry:
24  %i = tail call i32 @simpleFunction(i32 6) "function-inline-cost"="749"
25  %j = tail call i32 @simpleFunction(i32 %i) "function-inline-cost"="750"
26  ret i32 %j
27}
28
29attributes #0 = { nounwind readnone uwtable }
30