xref: /llvm-project/llvm/test/Transforms/Inline/AMDGPU/amdgpu-inline-stack-argument-i64.ll (revision e3515ba3816b9cabeca6a3b03b90902ebcfd3c65)
1; REQUIRES: asserts
2; RUN: opt -mtriple=amdgcn-amd-amdhsa -S -passes=inline -inline-cost-full=true -inline-threshold=0 -inline-instr-cost=5 -inline-call-penalty=0 -debug-only=inline < %s 2>&1 | FileCheck %s
3
4; CHECK:      NOT Inlining (cost={{[0-9]+}}, threshold={{[0-9]+}}), Call:   %noinlinecall1 = call noundef i64 @non_inlining_call
5; CHECK:      NOT Inlining (cost={{[0-9]+}}, threshold={{[0-9]+}}), Call:   %noinlinecall2 = call noundef i64 @non_inlining_call
6; CHECK-NOT:  NOT Inlining (cost={{[0-9]+}}, threshold={{[0-9]+}}), Call:   %inlinecall1 = call noundef i64 @inlining_call
7; CHECK-NOT:  NOT Inlining (cost={{[0-9]+}}, threshold={{[0-9]+}}), Call:   %inlinecall2 = call noundef i64 @inlining_call
8
9define noundef i64 @non_inlining_call(i64 noundef %a0, i64 noundef %b0, i64 noundef %c0, i64 noundef %d0, i64 noundef %e0, i64 noundef %f0, i64 noundef %g0, i64 noundef %h0, i64 noundef %i0, i64 noundef %j0, i64 noundef %k0, i64 noundef %l0, i64 noundef %m0, i64 noundef %n0, i64 noundef %o0, i64 noundef %p0) {
10entry:
11  %xor = xor i64 %a0, %b0
12  %xor1 = xor i64 %xor, %c0
13  %xor2 = xor i64 %xor1, %d0
14  %xor3 = xor i64 %xor2, %e0
15  %xor4 = xor i64 %xor3, %f0
16  %xor5 = xor i64 %xor4, %g0
17  %xor6 = xor i64 %xor5, %h0
18  %xor7 = xor i64 %xor6, %i0
19  %xor8 = xor i64 %xor7, %j0
20  %xor9 = xor i64 %xor8, %k0
21  %xor10 = xor i64 %xor9, %l0
22  %xor11 = xor i64 %xor10, %m0
23  %xor12 = xor i64 %xor11, %n0
24  %xor13 = xor i64 %xor12, %o0
25  %xor14 = xor i64 %xor13, %p0
26  %xor15 = xor i64 %xor14, 1
27  %xor16 = xor i64 %xor15, 2
28  ret i64 %xor16
29}
30
31define noundef i64 @inlining_call(i64 noundef %a0, i64 noundef %b0, i64 noundef %c0, i64 noundef %d0, i64 noundef %e0, i64 noundef %f0, i64 noundef %g0, i64 noundef %h0, i64 noundef %i0, i64 noundef %j0, i64 noundef %k0, i64 noundef %l0, i64 noundef %m0, i64 noundef %n0, i64 noundef %o0, i64 noundef %p0, i64 noundef %q0) {
32entry:
33  %xor = xor i64 %a0, %b0
34  %xor1 = xor i64 %xor, %c0
35  %xor2 = xor i64 %xor1, %d0
36  %xor3 = xor i64 %xor2, %e0
37  %xor4 = xor i64 %xor3, %f0
38  %xor5 = xor i64 %xor4, %g0
39  %xor6 = xor i64 %xor5, %h0
40  %xor7 = xor i64 %xor6, %i0
41  %xor8 = xor i64 %xor7, %j0
42  %xor9 = xor i64 %xor8, %k0
43  %xor10 = xor i64 %xor9, %l0
44  %xor11 = xor i64 %xor10, %m0
45  %xor12 = xor i64 %xor11, %n0
46  %xor13 = xor i64 %xor12, %o0
47  %xor14 = xor i64 %xor13, %p0
48  %xor15 = xor i64 %xor14, %q0
49  %xor16 = xor i64 %xor15, 1
50  %xor17 = xor i64 %xor16, 1
51  ret i64 %xor17
52}
53
54; Calling each (non-)inlining function twice to make sure they won't get the sole call inlining cost bonus.
55define i64 @Caller(ptr noundef %in) {
56entry:
57  %arrayidx = getelementptr inbounds i64, ptr %in, i64 0
58  %a0 = load i64, ptr %arrayidx, align 4
59  %arrayidx1 = getelementptr inbounds i64, ptr %in, i64 1
60  %b0 = load i64, ptr %arrayidx1, align 4
61  %arrayidx2 = getelementptr inbounds i64, ptr %in, i64 2
62  %c0 = load i64, ptr %arrayidx2, align 4
63  %arrayidx3 = getelementptr inbounds i64, ptr %in, i64 3
64  %d0 = load i64, ptr %arrayidx3, align 4
65  %arrayidx4 = getelementptr inbounds i64, ptr %in, i64 4
66  %e0 = load i64, ptr %arrayidx4, align 4
67  %arrayidx5 = getelementptr inbounds i64, ptr %in, i64 5
68  %f0 = load i64, ptr %arrayidx5, align 4
69  %arrayidx6 = getelementptr inbounds i64, ptr %in, i64 6
70  %g0 = load i64, ptr %arrayidx6, align 4
71  %arrayidx7 = getelementptr inbounds i64, ptr %in, i64 7
72  %h0 = load i64, ptr %arrayidx7, align 4
73  %arrayidx8 = getelementptr inbounds i64, ptr %in, i64 8
74  %i0 = load i64, ptr %arrayidx8, align 4
75  %arrayidx9 = getelementptr inbounds i64, ptr %in, i64 9
76  %j0 = load i64, ptr %arrayidx9, align 4
77  %arrayidx10 = getelementptr inbounds i64, ptr %in, i64 10
78  %k0 = load i64, ptr %arrayidx10, align 4
79  %arrayidx11 = getelementptr inbounds i64, ptr %in, i64 11
80  %l0 = load i64, ptr %arrayidx11, align 4
81  %arrayidx12 = getelementptr inbounds i64, ptr %in, i64 12
82  %m0 = load i64, ptr %arrayidx12, align 4
83  %arrayidx13 = getelementptr inbounds i64, ptr %in, i64 13
84  %n0 = load i64, ptr %arrayidx13, align 4
85  %arrayidx14 = getelementptr inbounds i64, ptr %in, i64 14
86  %o0 = load i64, ptr %arrayidx14, align 4
87  %arrayidx15 = getelementptr inbounds i64, ptr %in, i64 15
88  %p0 = load i64, ptr %arrayidx15, align 4
89  %arrayidx16 = getelementptr inbounds i64, ptr %in, i64 16
90  %q0 = load i64, ptr %arrayidx16, align 4
91  %noinlinecall1 = call noundef i64 @non_inlining_call(i64 noundef %a0, i64 noundef %b0, i64 noundef %c0, i64 noundef %d0, i64 noundef %e0, i64 noundef %f0, i64 noundef %g0, i64 noundef %h0, i64 noundef %i0, i64 noundef %j0, i64 noundef %k0, i64 noundef %l0, i64 noundef %m0, i64 noundef %n0, i64 noundef %o0, i64 noundef %p0)
92  %add = add i64 0, %noinlinecall1
93  %noinlinecall2 = call noundef i64 @non_inlining_call(i64 noundef %a0, i64 noundef %b0, i64 noundef %c0, i64 noundef %d0, i64 noundef %e0, i64 noundef %f0, i64 noundef %g0, i64 noundef %h0, i64 noundef %i0, i64 noundef %j0, i64 noundef %k0, i64 noundef %l0, i64 noundef %m0, i64 noundef %n0, i64 noundef %o0, i64 noundef %p0)
94  %add2 = add i64 %add, %noinlinecall2
95  %inlinecall1 = call noundef i64 @inlining_call(i64 noundef %a0, i64 noundef %b0, i64 noundef %c0, i64 noundef %d0, i64 noundef %e0, i64 noundef %f0, i64 noundef %g0, i64 noundef %h0, i64 noundef %i0, i64 noundef %j0, i64 noundef %k0, i64 noundef %l0, i64 noundef %m0, i64 noundef %n0, i64 noundef %o0, i64 noundef %p0, i64 noundef %q0)
96  %add3 = add i64 %add2, %inlinecall1
97  %inlinecall2 = call noundef i64 @inlining_call(i64 noundef %a0, i64 noundef %b0, i64 noundef %c0, i64 noundef %d0, i64 noundef %e0, i64 noundef %f0, i64 noundef %g0, i64 noundef %h0, i64 noundef %i0, i64 noundef %j0, i64 noundef %k0, i64 noundef %l0, i64 noundef %m0, i64 noundef %n0, i64 noundef %o0, i64 noundef %p0, i64 noundef %q0)
98  %add4 = add i64 %add3, %inlinecall2
99  ret i64 %add4
100}
101