1 ; RUN: opt -S -passes='cgscc(inline,instcombine)' < %s | FileCheck %s
2 ; RUN: opt -S -intra-scc-cost-multiplier=3 -passes='cgscc(inline,instcombine)' < %s | FileCheck %s --check-prefix=THREE
4 ; We use call to a dummy function to avoid inlining test1 into test2 or vice
5 ; versa, such that we aren't left with a trivial cycle, as trivial cycles are
6 ; special-cased to never be inlined.
7 ; However, InstCombine will eliminate these calls after inlining, and thus
8 ; make the functions eligible for inlining in their callers.
9 declare void @dummy() readnone nounwind willreturn
11 define void @test1() {
12 ; CHECK-LABEL: define void @test1(
13 ; CHECK-NEXT: call void @test2()
14 ; CHECK-NEXT: call void @test2()
15 ; CHECK-NEXT: ret void
33 define void @test2() {
34 ; CHECK-LABEL: define void @test2(
35 ; CHECK-NEXT: call void @test3()
36 ; CHECK-NEXT: call void @test3()
37 ; CHECK-NEXT: ret void
39 call void @test3() noinline
40 call void @test3() noinline
55 define void @test3() {
56 ; CHECK-LABEL: define void @test3(
57 ; CHECK-NEXT: call void @test1()
58 ; CHECK-NEXT: call void @test1()
59 ; CHECK-NEXT: ret void
77 ; The inlined call sites should have the "function-inline-cost-multiplier" call site attribute.
79 ; CHECK-LABEL: define void @f(
80 ; CHECK-NEXT: call void @test3() #[[COSTMULT:[0-9]+]]
81 ; CHECK-NEXT: call void @test3() #[[COSTMULT]]
82 ; CHECK-NEXT: call void @test3() #[[COSTMULT]]
83 ; CHECK-NEXT: call void @test3() #[[COSTMULT]]
84 ; CHECK-NEXT: call void @test3() #[[COSTMULT]]
85 ; CHECK-NEXT: call void @test3() #[[COSTMULT]]
86 ; CHECK-NEXT: call void @test3() #[[COSTMULT]]
87 ; CHECK-NEXT: call void @test3() #[[COSTMULT]]
88 ; CHECK-NEXT: ret void
95 ; CHECK: [[COSTMULT]] = { noinline "function-inline-cost-multiplier"="4" }
96 ; THREE: "function-inline-cost-multiplier"="9"