|
| 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 i32 @non_inlining_call |
| 5 | +; CHECK: NOT Inlining (cost={{[0-9]+}}, threshold={{[0-9]+}}), Call: %noinlinecall2 = call noundef i32 @non_inlining_call |
| 6 | +; CHECK-NOT: NOT Inlining (cost={{[0-9]+}}, threshold={{[0-9]+}}), Call: %inlinecall1 = call noundef i32 @inlining_call |
| 7 | +; CHECK-NOT: NOT Inlining (cost={{[0-9]+}}, threshold={{[0-9]+}}), Call: %inlinecall2 = call noundef i32 @inlining_call |
| 8 | + |
| 9 | +define noundef i32 @non_inlining_call(i32 noundef %a0, i32 noundef %b0, i32 noundef %c0, i32 noundef %d0, i32 noundef %e0, i32 noundef %f0, i32 noundef %g0, i32 noundef %h0, i32 noundef %i0, i32 noundef %j0, i32 noundef %k0, i32 noundef %l0, i32 noundef %m0, i32 noundef %n0, i32 noundef %o0, i32 noundef %p0, i32 noundef %q0, i32 noundef %r0, i32 noundef %s0, i32 noundef %t0, i32 noundef %u0, i32 noundef %v0, i32 noundef %w0, i32 noundef %x0, i32 noundef %y0, i32 noundef %z0, i32 noundef %a1, i32 noundef %b1, i32 noundef %c1, i32 noundef %d1, i32 noundef %e1, i32 noundef %f1) { |
| 10 | +entry: |
| 11 | + %xor = xor i32 %a0, %b0 |
| 12 | + %xor1 = xor i32 %xor, %c0 |
| 13 | + %xor2 = xor i32 %xor1, %d0 |
| 14 | + %xor3 = xor i32 %xor2, %e0 |
| 15 | + %xor4 = xor i32 %xor3, %f0 |
| 16 | + %xor5 = xor i32 %xor4, %g0 |
| 17 | + %xor6 = xor i32 %xor5, %h0 |
| 18 | + %xor7 = xor i32 %xor6, %i0 |
| 19 | + %xor8 = xor i32 %xor7, %j0 |
| 20 | + %xor9 = xor i32 %xor8, %k0 |
| 21 | + %xor10 = xor i32 %xor9, %l0 |
| 22 | + %xor11 = xor i32 %xor10, %m0 |
| 23 | + %xor12 = xor i32 %xor11, %n0 |
| 24 | + %xor13 = xor i32 %xor12, %o0 |
| 25 | + %xor14 = xor i32 %xor13, %p0 |
| 26 | + %xor15 = xor i32 %xor14, %q0 |
| 27 | + %xor16 = xor i32 %xor15, %r0 |
| 28 | + %xor17 = xor i32 %xor16, %s0 |
| 29 | + %xor18 = xor i32 %xor17, %t0 |
| 30 | + %xor19 = xor i32 %xor18, %u0 |
| 31 | + %xor20 = xor i32 %xor19, %v0 |
| 32 | + %xor21 = xor i32 %xor20, %w0 |
| 33 | + %xor22 = xor i32 %xor21, %x0 |
| 34 | + %xor23 = xor i32 %xor22, %y0 |
| 35 | + %xor24 = xor i32 %xor23, %z0 |
| 36 | + %xor25 = xor i32 %xor24, %a1 |
| 37 | + %xor26 = xor i32 %xor25, %b1 |
| 38 | + %xor27 = xor i32 %xor26, %c1 |
| 39 | + %xor28 = xor i32 %xor27, %d1 |
| 40 | + %xor29 = xor i32 %xor28, %e1 |
| 41 | + %xor30 = xor i32 %xor29, %f1 |
| 42 | + %xor31 = xor i32 %xor30, 1 |
| 43 | + %xor32 = xor i32 %xor31, 2 |
| 44 | + ret i32 %xor32 |
| 45 | +} |
| 46 | + |
| 47 | +define noundef i32 @inlining_call(i32 noundef %a0, i32 noundef %b0, i32 noundef %c0, i32 noundef %d0, i32 noundef %e0, i32 noundef %f0, i32 noundef %g0, i32 noundef %h0, i32 noundef %i0, i32 noundef %j0, i32 noundef %k0, i32 noundef %l0, i32 noundef %m0, i32 noundef %n0, i32 noundef %o0, i32 noundef %p0, i32 noundef %q0, i32 noundef %r0, i32 noundef %s0, i32 noundef %t0, i32 noundef %u0, i32 noundef %v0, i32 noundef %w0, i32 noundef %x0, i32 noundef %y0, i32 noundef %z0, i32 noundef %a1, i32 noundef %b1, i32 noundef %c1, i32 noundef %d1, i32 noundef %e1, i32 noundef %f1, i32 noundef %g1) { |
| 48 | +entry: |
| 49 | + %xor = xor i32 %a0, %b0 |
| 50 | + %xor1 = xor i32 %xor, %c0 |
| 51 | + %xor2 = xor i32 %xor1, %d0 |
| 52 | + %xor3 = xor i32 %xor2, %e0 |
| 53 | + %xor4 = xor i32 %xor3, %f0 |
| 54 | + %xor5 = xor i32 %xor4, %g0 |
| 55 | + %xor6 = xor i32 %xor5, %h0 |
| 56 | + %xor7 = xor i32 %xor6, %i0 |
| 57 | + %xor8 = xor i32 %xor7, %j0 |
| 58 | + %xor9 = xor i32 %xor8, %k0 |
| 59 | + %xor10 = xor i32 %xor9, %l0 |
| 60 | + %xor11 = xor i32 %xor10, %m0 |
| 61 | + %xor12 = xor i32 %xor11, %n0 |
| 62 | + %xor13 = xor i32 %xor12, %o0 |
| 63 | + %xor14 = xor i32 %xor13, %p0 |
| 64 | + %xor15 = xor i32 %xor14, %q0 |
| 65 | + %xor16 = xor i32 %xor15, %r0 |
| 66 | + %xor17 = xor i32 %xor16, %s0 |
| 67 | + %xor18 = xor i32 %xor17, %t0 |
| 68 | + %xor19 = xor i32 %xor18, %u0 |
| 69 | + %xor20 = xor i32 %xor19, %v0 |
| 70 | + %xor21 = xor i32 %xor20, %w0 |
| 71 | + %xor22 = xor i32 %xor21, %x0 |
| 72 | + %xor23 = xor i32 %xor22, %y0 |
| 73 | + %xor24 = xor i32 %xor23, %z0 |
| 74 | + %xor25 = xor i32 %xor24, %a1 |
| 75 | + %xor26 = xor i32 %xor25, %b1 |
| 76 | + %xor27 = xor i32 %xor26, %c1 |
| 77 | + %xor28 = xor i32 %xor27, %d1 |
| 78 | + %xor29 = xor i32 %xor28, %e1 |
| 79 | + %xor30 = xor i32 %xor29, %f1 |
| 80 | + %xor31 = xor i32 %xor30, %g1 |
| 81 | + %xor32 = xor i32 %xor30, 1 |
| 82 | + %xor33 = xor i32 %xor31, 2 |
| 83 | + ret i32 %xor33 |
| 84 | +} |
| 85 | + |
| 86 | +; Calling each (non-)inlining function twice to make sure they won't get the sole call inlining cost bonus. |
| 87 | +define i32 @Caller(ptr noundef %in) { |
| 88 | +entry: |
| 89 | + %arrayidx = getelementptr inbounds i32, ptr %in, i64 0 |
| 90 | + %a0 = load i32, ptr %arrayidx, align 4 |
| 91 | + %arrayidx1 = getelementptr inbounds i32, ptr %in, i64 1 |
| 92 | + %b0 = load i32, ptr %arrayidx1, align 4 |
| 93 | + %arrayidx2 = getelementptr inbounds i32, ptr %in, i64 2 |
| 94 | + %c0 = load i32, ptr %arrayidx2, align 4 |
| 95 | + %arrayidx3 = getelementptr inbounds i32, ptr %in, i64 3 |
| 96 | + %d0 = load i32, ptr %arrayidx3, align 4 |
| 97 | + %arrayidx4 = getelementptr inbounds i32, ptr %in, i64 4 |
| 98 | + %e0 = load i32, ptr %arrayidx4, align 4 |
| 99 | + %arrayidx5 = getelementptr inbounds i32, ptr %in, i64 5 |
| 100 | + %f0 = load i32, ptr %arrayidx5, align 4 |
| 101 | + %arrayidx6 = getelementptr inbounds i32, ptr %in, i64 6 |
| 102 | + %g0 = load i32, ptr %arrayidx6, align 4 |
| 103 | + %arrayidx7 = getelementptr inbounds i32, ptr %in, i64 7 |
| 104 | + %h0 = load i32, ptr %arrayidx7, align 4 |
| 105 | + %arrayidx8 = getelementptr inbounds i32, ptr %in, i64 8 |
| 106 | + %i0 = load i32, ptr %arrayidx8, align 4 |
| 107 | + %arrayidx9 = getelementptr inbounds i32, ptr %in, i64 9 |
| 108 | + %j0 = load i32, ptr %arrayidx9, align 4 |
| 109 | + %arrayidx10 = getelementptr inbounds i32, ptr %in, i64 10 |
| 110 | + %k0 = load i32, ptr %arrayidx10, align 4 |
| 111 | + %arrayidx11 = getelementptr inbounds i32, ptr %in, i64 11 |
| 112 | + %l0 = load i32, ptr %arrayidx11, align 4 |
| 113 | + %arrayidx12 = getelementptr inbounds i32, ptr %in, i64 12 |
| 114 | + %m0 = load i32, ptr %arrayidx12, align 4 |
| 115 | + %arrayidx13 = getelementptr inbounds i32, ptr %in, i64 13 |
| 116 | + %n0 = load i32, ptr %arrayidx13, align 4 |
| 117 | + %arrayidx14 = getelementptr inbounds i32, ptr %in, i64 14 |
| 118 | + %o0 = load i32, ptr %arrayidx14, align 4 |
| 119 | + %arrayidx15 = getelementptr inbounds i32, ptr %in, i64 15 |
| 120 | + %p0 = load i32, ptr %arrayidx15, align 4 |
| 121 | + %arrayidx16 = getelementptr inbounds i32, ptr %in, i64 16 |
| 122 | + %q0 = load i32, ptr %arrayidx16, align 4 |
| 123 | + %arrayidx17 = getelementptr inbounds i32, ptr %in, i64 17 |
| 124 | + %r0 = load i32, ptr %arrayidx17, align 4 |
| 125 | + %arrayidx18 = getelementptr inbounds i32, ptr %in, i64 18 |
| 126 | + %s0 = load i32, ptr %arrayidx18, align 4 |
| 127 | + %arrayidx19 = getelementptr inbounds i32, ptr %in, i64 19 |
| 128 | + %t0 = load i32, ptr %arrayidx19, align 4 |
| 129 | + %arrayidx20 = getelementptr inbounds i32, ptr %in, i64 20 |
| 130 | + %u0 = load i32, ptr %arrayidx20, align 4 |
| 131 | + %arrayidx21 = getelementptr inbounds i32, ptr %in, i64 21 |
| 132 | + %v0 = load i32, ptr %arrayidx21, align 4 |
| 133 | + %arrayidx22 = getelementptr inbounds i32, ptr %in, i64 22 |
| 134 | + %w0 = load i32, ptr %arrayidx22, align 4 |
| 135 | + %arrayidx23 = getelementptr inbounds i32, ptr %in, i64 23 |
| 136 | + %x0 = load i32, ptr %arrayidx23, align 4 |
| 137 | + %arrayidx24 = getelementptr inbounds i32, ptr %in, i64 24 |
| 138 | + %y0 = load i32, ptr %arrayidx24, align 4 |
| 139 | + %arrayidx25 = getelementptr inbounds i32, ptr %in, i64 25 |
| 140 | + %z0 = load i32, ptr %arrayidx25, align 4 |
| 141 | + %arrayidx26 = getelementptr inbounds i32, ptr %in, i64 26 |
| 142 | + %a1 = load i32, ptr %arrayidx26, align 4 |
| 143 | + %arrayidx27 = getelementptr inbounds i32, ptr %in, i64 27 |
| 144 | + %b1 = load i32, ptr %arrayidx27, align 4 |
| 145 | + %arrayidx28 = getelementptr inbounds i32, ptr %in, i64 28 |
| 146 | + %c1 = load i32, ptr %arrayidx28, align 4 |
| 147 | + %arrayidx29 = getelementptr inbounds i32, ptr %in, i64 29 |
| 148 | + %d1 = load i32, ptr %arrayidx29, align 4 |
| 149 | + %arrayidx30 = getelementptr inbounds i32, ptr %in, i64 30 |
| 150 | + %e1 = load i32, ptr %arrayidx30, align 4 |
| 151 | + %arrayidx31 = getelementptr inbounds i32, ptr %in, i64 31 |
| 152 | + %f1 = load i32, ptr %arrayidx31, align 4 |
| 153 | + %arrayidx32 = getelementptr inbounds i32, ptr %in, i64 32 |
| 154 | + %g1 = load i32, ptr %arrayidx32, align 4 |
| 155 | + %noinlinecall1 = call noundef i32 @non_inlining_call(i32 noundef %a0, i32 noundef %b0, i32 noundef %c0, i32 noundef %d0, i32 noundef %e0, i32 noundef %f0, i32 noundef %g0, i32 noundef %h0, i32 noundef %i0, i32 noundef %j0, i32 noundef %k0, i32 noundef %l0, i32 noundef %m0, i32 noundef %n0, i32 noundef %o0, i32 noundef %p0, i32 noundef %q0, i32 noundef %r0, i32 noundef %s0, i32 noundef %t0, i32 noundef %u0, i32 noundef %v0, i32 noundef %w0, i32 noundef %x0, i32 noundef %y0, i32 noundef %z0, i32 noundef %a1, i32 noundef %b1, i32 noundef %c1, i32 noundef %d1, i32 noundef %e1, i32 noundef %f1) |
| 156 | + %add = add i32 0, %noinlinecall1 |
| 157 | + %noinlinecall2 = call noundef i32 @non_inlining_call(i32 noundef %a0, i32 noundef %b0, i32 noundef %c0, i32 noundef %d0, i32 noundef %e0, i32 noundef %f0, i32 noundef %g0, i32 noundef %h0, i32 noundef %i0, i32 noundef %j0, i32 noundef %k0, i32 noundef %l0, i32 noundef %m0, i32 noundef %n0, i32 noundef %o0, i32 noundef %p0, i32 noundef %q0, i32 noundef %r0, i32 noundef %s0, i32 noundef %t0, i32 noundef %u0, i32 noundef %v0, i32 noundef %w0, i32 noundef %x0, i32 noundef %y0, i32 noundef %z0, i32 noundef %a1, i32 noundef %b1, i32 noundef %c1, i32 noundef %d1, i32 noundef %e1, i32 noundef %f1) |
| 158 | + %add2 = add i32 %add, %noinlinecall2 |
| 159 | + %inlinecall1 = call noundef i32 @inlining_call(i32 noundef %a0, i32 noundef %b0, i32 noundef %c0, i32 noundef %d0, i32 noundef %e0, i32 noundef %f0, i32 noundef %g0, i32 noundef %h0, i32 noundef %i0, i32 noundef %j0, i32 noundef %k0, i32 noundef %l0, i32 noundef %m0, i32 noundef %n0, i32 noundef %o0, i32 noundef %p0, i32 noundef %q0, i32 noundef %r0, i32 noundef %s0, i32 noundef %t0, i32 noundef %u0, i32 noundef %v0, i32 noundef %w0, i32 noundef %x0, i32 noundef %y0, i32 noundef %z0, i32 noundef %a1, i32 noundef %b1, i32 noundef %c1, i32 noundef %d1, i32 noundef %e1, i32 noundef %f1, i32 noundef %g1) |
| 160 | + %add3 = add i32 %add2, %inlinecall1 |
| 161 | + %inlinecall2 = call noundef i32 @inlining_call(i32 noundef %a0, i32 noundef %b0, i32 noundef %c0, i32 noundef %d0, i32 noundef %e0, i32 noundef %f0, i32 noundef %g0, i32 noundef %h0, i32 noundef %i0, i32 noundef %j0, i32 noundef %k0, i32 noundef %l0, i32 noundef %m0, i32 noundef %n0, i32 noundef %o0, i32 noundef %p0, i32 noundef %q0, i32 noundef %r0, i32 noundef %s0, i32 noundef %t0, i32 noundef %u0, i32 noundef %v0, i32 noundef %w0, i32 noundef %x0, i32 noundef %y0, i32 noundef %z0, i32 noundef %a1, i32 noundef %b1, i32 noundef %c1, i32 noundef %d1, i32 noundef %e1, i32 noundef %f1, i32 noundef %g1) |
| 162 | + %add4 = add i32 %add3, %inlinecall2 |
| 163 | + ret i32 %add4 |
| 164 | +} |
0 commit comments