165 lines · plain
1; REQUIRES: asserts2; 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 %s3 4; CHECK: NOT Inlining (cost={{[0-9]+}}, threshold={{[0-9]+}}), Call: %noinlinecall1 = call noundef i32 @non_inlining_call5; CHECK: NOT Inlining (cost={{[0-9]+}}, threshold={{[0-9]+}}), Call: %noinlinecall2 = call noundef i32 @non_inlining_call6; CHECK-NOT: NOT Inlining (cost={{[0-9]+}}, threshold={{[0-9]+}}), Call: %inlinecall1 = call noundef i32 @inlining_call7; CHECK-NOT: NOT Inlining (cost={{[0-9]+}}, threshold={{[0-9]+}}), Call: %inlinecall2 = call noundef i32 @inlining_call8 9define 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) {10entry:11 %xor = xor i32 %a0, %b012 %xor1 = xor i32 %xor, %c013 %xor2 = xor i32 %xor1, %d014 %xor3 = xor i32 %xor2, %e015 %xor4 = xor i32 %xor3, %f016 %xor5 = xor i32 %xor4, %g017 %xor6 = xor i32 %xor5, %h018 %xor7 = xor i32 %xor6, %i019 %xor8 = xor i32 %xor7, %j020 %xor9 = xor i32 %xor8, %k021 %xor10 = xor i32 %xor9, %l022 %xor11 = xor i32 %xor10, %m023 %xor12 = xor i32 %xor11, %n024 %xor13 = xor i32 %xor12, %o025 %xor14 = xor i32 %xor13, %p026 %xor15 = xor i32 %xor14, %q027 %xor16 = xor i32 %xor15, %r028 %xor17 = xor i32 %xor16, %s029 %xor18 = xor i32 %xor17, %t030 %xor19 = xor i32 %xor18, %u031 %xor20 = xor i32 %xor19, %v032 %xor21 = xor i32 %xor20, %w033 %xor22 = xor i32 %xor21, %x034 %xor23 = xor i32 %xor22, %y035 %xor24 = xor i32 %xor23, %z036 %xor25 = xor i32 %xor24, %a137 %xor26 = xor i32 %xor25, %b138 %xor27 = xor i32 %xor26, %c139 %xor28 = xor i32 %xor27, %d140 %xor29 = xor i32 %xor28, %e141 %xor30 = xor i32 %xor29, %f142 %xor31 = xor i32 %xor30, 143 %xor32 = xor i32 %xor31, 244 ret i32 %xor3245}46 47define 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) {48entry:49 %xor = xor i32 %a0, %b050 %xor1 = xor i32 %xor, %c051 %xor2 = xor i32 %xor1, %d052 %xor3 = xor i32 %xor2, %e053 %xor4 = xor i32 %xor3, %f054 %xor5 = xor i32 %xor4, %g055 %xor6 = xor i32 %xor5, %h056 %xor7 = xor i32 %xor6, %i057 %xor8 = xor i32 %xor7, %j058 %xor9 = xor i32 %xor8, %k059 %xor10 = xor i32 %xor9, %l060 %xor11 = xor i32 %xor10, %m061 %xor12 = xor i32 %xor11, %n062 %xor13 = xor i32 %xor12, %o063 %xor14 = xor i32 %xor13, %p064 %xor15 = xor i32 %xor14, %q065 %xor16 = xor i32 %xor15, %r066 %xor17 = xor i32 %xor16, %s067 %xor18 = xor i32 %xor17, %t068 %xor19 = xor i32 %xor18, %u069 %xor20 = xor i32 %xor19, %v070 %xor21 = xor i32 %xor20, %w071 %xor22 = xor i32 %xor21, %x072 %xor23 = xor i32 %xor22, %y073 %xor24 = xor i32 %xor23, %z074 %xor25 = xor i32 %xor24, %a175 %xor26 = xor i32 %xor25, %b176 %xor27 = xor i32 %xor26, %c177 %xor28 = xor i32 %xor27, %d178 %xor29 = xor i32 %xor28, %e179 %xor30 = xor i32 %xor29, %f180 %xor31 = xor i32 %xor30, %g181 %xor32 = xor i32 %xor30, 182 %xor33 = xor i32 %xor31, 283 ret i32 %xor3384}85 86; Calling each (non-)inlining function twice to make sure they won't get the sole call inlining cost bonus. 87define i32 @Caller(ptr noundef %in) {88entry:89 %arrayidx = getelementptr inbounds i32, ptr %in, i64 090 %a0 = load i32, ptr %arrayidx, align 491 %arrayidx1 = getelementptr inbounds i32, ptr %in, i64 192 %b0 = load i32, ptr %arrayidx1, align 493 %arrayidx2 = getelementptr inbounds i32, ptr %in, i64 294 %c0 = load i32, ptr %arrayidx2, align 495 %arrayidx3 = getelementptr inbounds i32, ptr %in, i64 396 %d0 = load i32, ptr %arrayidx3, align 497 %arrayidx4 = getelementptr inbounds i32, ptr %in, i64 498 %e0 = load i32, ptr %arrayidx4, align 499 %arrayidx5 = getelementptr inbounds i32, ptr %in, i64 5100 %f0 = load i32, ptr %arrayidx5, align 4101 %arrayidx6 = getelementptr inbounds i32, ptr %in, i64 6102 %g0 = load i32, ptr %arrayidx6, align 4103 %arrayidx7 = getelementptr inbounds i32, ptr %in, i64 7104 %h0 = load i32, ptr %arrayidx7, align 4105 %arrayidx8 = getelementptr inbounds i32, ptr %in, i64 8106 %i0 = load i32, ptr %arrayidx8, align 4107 %arrayidx9 = getelementptr inbounds i32, ptr %in, i64 9108 %j0 = load i32, ptr %arrayidx9, align 4109 %arrayidx10 = getelementptr inbounds i32, ptr %in, i64 10110 %k0 = load i32, ptr %arrayidx10, align 4111 %arrayidx11 = getelementptr inbounds i32, ptr %in, i64 11112 %l0 = load i32, ptr %arrayidx11, align 4113 %arrayidx12 = getelementptr inbounds i32, ptr %in, i64 12114 %m0 = load i32, ptr %arrayidx12, align 4115 %arrayidx13 = getelementptr inbounds i32, ptr %in, i64 13116 %n0 = load i32, ptr %arrayidx13, align 4117 %arrayidx14 = getelementptr inbounds i32, ptr %in, i64 14118 %o0 = load i32, ptr %arrayidx14, align 4119 %arrayidx15 = getelementptr inbounds i32, ptr %in, i64 15120 %p0 = load i32, ptr %arrayidx15, align 4121 %arrayidx16 = getelementptr inbounds i32, ptr %in, i64 16122 %q0 = load i32, ptr %arrayidx16, align 4123 %arrayidx17 = getelementptr inbounds i32, ptr %in, i64 17124 %r0 = load i32, ptr %arrayidx17, align 4125 %arrayidx18 = getelementptr inbounds i32, ptr %in, i64 18126 %s0 = load i32, ptr %arrayidx18, align 4127 %arrayidx19 = getelementptr inbounds i32, ptr %in, i64 19128 %t0 = load i32, ptr %arrayidx19, align 4129 %arrayidx20 = getelementptr inbounds i32, ptr %in, i64 20130 %u0 = load i32, ptr %arrayidx20, align 4131 %arrayidx21 = getelementptr inbounds i32, ptr %in, i64 21132 %v0 = load i32, ptr %arrayidx21, align 4133 %arrayidx22 = getelementptr inbounds i32, ptr %in, i64 22134 %w0 = load i32, ptr %arrayidx22, align 4135 %arrayidx23 = getelementptr inbounds i32, ptr %in, i64 23136 %x0 = load i32, ptr %arrayidx23, align 4137 %arrayidx24 = getelementptr inbounds i32, ptr %in, i64 24138 %y0 = load i32, ptr %arrayidx24, align 4139 %arrayidx25 = getelementptr inbounds i32, ptr %in, i64 25140 %z0 = load i32, ptr %arrayidx25, align 4141 %arrayidx26 = getelementptr inbounds i32, ptr %in, i64 26142 %a1 = load i32, ptr %arrayidx26, align 4143 %arrayidx27 = getelementptr inbounds i32, ptr %in, i64 27144 %b1 = load i32, ptr %arrayidx27, align 4145 %arrayidx28 = getelementptr inbounds i32, ptr %in, i64 28146 %c1 = load i32, ptr %arrayidx28, align 4147 %arrayidx29 = getelementptr inbounds i32, ptr %in, i64 29148 %d1 = load i32, ptr %arrayidx29, align 4149 %arrayidx30 = getelementptr inbounds i32, ptr %in, i64 30150 %e1 = load i32, ptr %arrayidx30, align 4151 %arrayidx31 = getelementptr inbounds i32, ptr %in, i64 31152 %f1 = load i32, ptr %arrayidx31, align 4153 %arrayidx32 = getelementptr inbounds i32, ptr %in, i64 32154 %g1 = load i32, ptr %arrayidx32, align 4155 %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, %noinlinecall1157 %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, %noinlinecall2159 %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, %inlinecall1161 %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, %inlinecall2163 ret i32 %add4164}165