2 ; RUN: opt -inline-cost-full -passes='cgscc(inline)' -debug-only=inline -disable-output %s 2>&1 | FileCheck --check-prefix=INLINER %s
3 ; RUN: opt -inline-cost-full -passes='print<inline-cost>' -disable-output %s 2>&1 | FileCheck --check-prefix=COST %s
5 declare void @extern() "call-threshold-bonus"="31"
7 define void @fn1() "function-inline-cost"="321" "function-inline-threshold"="123" "call-inline-cost"="271" {
12 define void @fn2() "function-inline-threshold"="41" {
13 ; INLINER-LABEL: Inlining calls in: fn2
14 ; INLINER-NEXT: Function size: 7
15 ; INLINER-NEXT: NOT Inlining (cost=321, threshold=123), Call: call void @fn1()
16 ; INLINER-NEXT: NOT Inlining (cost=963, threshold=123), Call: call void @fn1()
17 ; INLINER-NEXT: NOT Inlining (cost=321, threshold=321), Call: call void @fn1()
18 ; INLINER-NEXT: NOT Inlining (cost=197, threshold=123), Call: call void @fn1()
19 ; INLINER-NEXT: Inlining (cost=197, threshold=321), Call: call void @fn1()
21 ; COST-LABEL: define void @fn2()
23 ; COST-NEXT: threshold delta = 31
24 ; COST-NEXT: call void @extern()
25 ; COST-NEXT: cost delta = 132, threshold delta = 193
26 ; COST-NEXT: call void @fn1()
27 ; COST-NEXT: cost delta = 132, threshold delta = 193
28 ; COST-NEXT: call void @fn1()
29 ; COST-NEXT: cost delta = 0
30 ; COST-NEXT: call void @fn1()
31 ; COST-NEXT: cost delta = 271, threshold delta = 17
32 ; COST-NEXT: call void @fn1()
33 ; COST-NEXT: cost delta = 473
34 ; COST-NEXT: call void @fn1()
38 call void @fn1() "call-inline-cost"="132" "call-threshold-bonus"="193"
39 call void @fn1() "call-inline-cost"="132" "call-threshold-bonus"="193" "function-inline-cost-multiplier"="3"
40 call void @fn1() "call-inline-cost"="0" "function-inline-threshold"="321"
41 call void @fn1() "call-threshold-bonus"="17" "function-inline-cost"="197"
42 call void @fn1() "call-inline-cost"="473" "function-inline-cost"="197" "function-inline-threshold"="321"
47 ; INLINER-LABEL: Inlining calls in: fn3
48 ; INLINER-NEXT: Function size: 3
49 ; INLINER-NEXT: Inlining (cost=386, threshold=849), Call: call void @fn1()
50 ; INLINER-NEXT: Size after inlining: 2
51 ; INLINER-NEXT: NOT Inlining (cost=535, threshold=41), Call: call void @fn2()
54 call void @fn1() "function-inline-cost"="386" "function-inline-threshold"="849"