Skip to content

Commit 3f0cabb

Browse files
committed
[InlineCost][precommit]: Add test file
1 parent 308e479 commit 3f0cabb

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
; RUN: opt -passes='cgscc(inline),instcombine,cgscc(inline)' -S -debug-only=inline -disable-output < %s 2>&1 | FileCheck %s
2+
3+
; CHECK: Inlining calls in: test
4+
; CHECK: Function size: 2
5+
; CHECK: Inlining (cost=-35, threshold=337), Call: %call = tail call float @inline_rec_true_successor(float %x, float %scale)
6+
; CHECK: Size after inlining: 10
7+
8+
; CHECK: Inlining calls in: inline_rec_true_successor
9+
; CHECK: Function size: 10
10+
; CHECK: Inlining (cost=-35, threshold=337), Call: %call = tail call float @inline_rec_true_successor(float %fneg, float %scale)
11+
; CHECK: Size after inlining: 17
12+
; CHECK: NOT Inlining (cost=never): noinline function attribute, Call: %call_test = tail call float @test(float %fneg, float %common.ret18.op.i)
13+
14+
15+
define float @test(float %x, float %scale) noinline {
16+
entry:
17+
%call = tail call float @inline_rec_true_successor(float %x, float %scale)
18+
ret float %call
19+
}
20+
21+
define float @inline_rec_true_successor(float %x, float %scale) {
22+
entry:
23+
%cmp = fcmp olt float %x, 0.000000e+00
24+
br i1 %cmp, label %if.then, label %if.end
25+
26+
common.ret18: ; preds = %if.then, %if.end
27+
%common.ret18.op = phi float [ %call_test, %if.then ], [ %mul, %if.end ]
28+
ret float %common.ret18.op
29+
30+
if.then: ; preds = %entry
31+
%fneg = fneg float %x
32+
%call = tail call float @inline_rec_true_successor(float %fneg, float %scale)
33+
%call_test = tail call float @test(float %fneg, float %call)
34+
br label %common.ret18
35+
36+
if.end: ; preds = %entry
37+
%mul = fmul float %x, %scale
38+
br label %common.ret18
39+
}

0 commit comments

Comments
 (0)