1 ; RUN: opt < %s -passes='require<profile-summary>,cgscc(inline)' -S -inlinecold-threshold=25 | FileCheck %s
2 ; Test that functions with attribute Cold are not inlined while the
3 ; same function without attribute Cold will be inlined.
5 ; RUN: opt < %s -passes='require<profile-summary>,cgscc(inline)' -S -inline-threshold=600 | FileCheck %s -check-prefix=OVERRIDE
6 ; The command line argument for inline-threshold should override
7 ; the default cold threshold, so a cold function with size bigger
8 ; than the default cold threshold (225) will be inlined.
10 ; RUN: opt < %s -passes='require<profile-summary>,cgscc(inline)' -S | FileCheck %s -check-prefix=DEFAULT
11 ; The same cold function will not be inlined with the default behavior.
15 ; This function should be larger than the cold threshold (75), but smaller
16 ; than the regular threshold.
17 ; Function Attrs: nounwind readnone uwtable
18 define i32 @simpleFunction(i32 %a) #0 "function-inline-cost"="80" {
23 ; Function Attrs: nounwind cold readnone uwtable
24 define i32 @ColdFunction(i32 %a) #1 "function-inline-cost"="30" {
25 ; CHECK-LABEL: @ColdFunction
27 ; OVERRIDE-LABEL: @ColdFunction
29 ; DEFAULT-LABEL: @ColdFunction
35 ; This function should be larger than the default cold threshold (225).
36 define i32 @ColdFunction2(i32 %a) #1 "function-inline-cost"="250" {
37 ; CHECK-LABEL: @ColdFunction2
39 ; OVERRIDE-LABEL: @ColdFunction2
41 ; DEFAULT-LABEL: @ColdFunction2
47 ; Function Attrs: nounwind readnone uwtable
48 define i32 @bar(i32 %a) #0 {
50 ; CHECK: call i32 @ColdFunction(i32 5)
51 ; CHECK-NOT: call i32 @simpleFunction(i32 6)
52 ; CHECK: call i32 @ColdFunction2(i32 5)
54 ; OVERRIDE-LABEL: @bar
55 ; OVERRIDE-NOT: call i32 @ColdFunction(i32 5)
56 ; OVERRIDE-NOT: call i32 @simpleFunction(i32 6)
57 ; OVERRIDE-NOT: call i32 @ColdFunction2(i32 5)
60 ; DEFAULT-NOT: call i32 @ColdFunction(i32 5)
61 ; DEFAULT-NOT: call i32 @simpleFunction(i32 6)
62 ; DEFAULT: call i32 @ColdFunction2(i32 5)
65 %0 = tail call i32 @ColdFunction(i32 5)
66 %1 = tail call i32 @simpleFunction(i32 6)
67 %2 = tail call i32 @ColdFunction2(i32 5)
73 declare void @extern()
74 attributes #0 = { nounwind readnone uwtable }
75 attributes #1 = { nounwind cold readnone uwtable }