119 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 i64 @non_inlining_call5; CHECK: NOT Inlining (cost={{[0-9]+}}, threshold={{[0-9]+}}), Call: %noinlinecall2 = call noundef i64 @non_inlining_call6; CHECK-NOT: NOT Inlining (cost={{[0-9]+}}, threshold={{[0-9]+}}), Call: %inlinecall1 = call noundef i64 @inlining_call7; CHECK-NOT: NOT Inlining (cost={{[0-9]+}}, threshold={{[0-9]+}}), Call: %inlinecall2 = call noundef i64 @inlining_call8 9define noundef i64 @non_inlining_call(<2 x ptr> noundef %ptrvec, ptr noundef %ptrc0, ptr noundef %ptrd0, ptr noundef %ptre0, ptr noundef %ptrf0, ptr noundef %ptrg0, ptr noundef %ptrh0, ptr noundef %ptri0, ptr noundef %ptrj0, ptr noundef %ptrk0, ptr noundef %ptrl0, ptr noundef %ptrm0, ptr noundef %ptrn0, ptr noundef %ptro0, ptr noundef %ptrp0) {10entry:11 %ptra0 = extractelement <2 x ptr> %ptrvec, i32 012 %ptrb0 = extractelement <2 x ptr> %ptrvec, i32 113 %a0 = load i64, ptr %ptra0, align 814 %b0 = load i64, ptr %ptrb0, align 815 %c0 = load i64, ptr %ptrc0, align 816 %d0 = load i64, ptr %ptrd0, align 817 %e0 = load i64, ptr %ptre0, align 818 %f0 = load i64, ptr %ptrf0, align 819 %g0 = load i64, ptr %ptrg0, align 820 %h0 = load i64, ptr %ptrh0, align 821 %i0 = load i64, ptr %ptri0, align 822 %j0 = load i64, ptr %ptrj0, align 823 %k0 = load i64, ptr %ptrk0, align 824 %l0 = load i64, ptr %ptrl0, align 825 %m0 = load i64, ptr %ptrm0, align 826 %n0 = load i64, ptr %ptrn0, align 827 %o0 = load i64, ptr %ptro0, align 828 %p0 = load i64, ptr %ptrp0, align 829 %xor = xor i64 %a0, %b030 %xor1 = xor i64 %xor, %c031 %xor2 = xor i64 %xor1, %d032 %xor3 = xor i64 %xor2, %e033 %xor4 = xor i64 %xor3, %f034 %xor5 = xor i64 %xor4, %g035 %xor6 = xor i64 %xor5, %h036 %xor7 = xor i64 %xor6, %i037 %xor8 = xor i64 %xor7, %j038 %xor9 = xor i64 %xor8, %k039 %xor10 = xor i64 %xor9, %l040 %xor11 = xor i64 %xor10, %m041 %xor12 = xor i64 %xor11, %n042 %xor13 = xor i64 %xor12, %o043 %xor14 = xor i64 %xor13, %p044 ret i64 %xor1445}46 47define noundef i64 @inlining_call(<2 x ptr> noundef %ptrvec, ptr noundef %ptrc0, ptr noundef %ptrd0, ptr noundef %ptre0, ptr noundef %ptrf0, ptr noundef %ptrg0, ptr noundef %ptrh0, ptr noundef %ptri0, ptr noundef %ptrj0, ptr noundef %ptrk0, ptr noundef %ptrl0, ptr noundef %ptrm0, ptr noundef %ptrn0, ptr noundef %ptro0, ptr noundef %ptrp0, ptr noundef %ptrq0) {48entry:49 %ptra0 = extractelement <2 x ptr> %ptrvec, i32 050 %ptrb0 = extractelement <2 x ptr> %ptrvec, i32 151 %a0 = load i64, ptr %ptra0, align 852 %b0 = load i64, ptr %ptrb0, align 853 %c0 = load i64, ptr %ptrc0, align 854 %d0 = load i64, ptr %ptrd0, align 855 %e0 = load i64, ptr %ptre0, align 856 %f0 = load i64, ptr %ptrf0, align 857 %g0 = load i64, ptr %ptrg0, align 858 %h0 = load i64, ptr %ptrh0, align 859 %i0 = load i64, ptr %ptri0, align 860 %j0 = load i64, ptr %ptrj0, align 861 %k0 = load i64, ptr %ptrk0, align 862 %l0 = load i64, ptr %ptrl0, align 863 %m0 = load i64, ptr %ptrm0, align 864 %n0 = load i64, ptr %ptrn0, align 865 %o0 = load i64, ptr %ptro0, align 866 %p0 = load i64, ptr %ptrp0, align 867 %q0 = load i64, ptr %ptrq0, align 868 %xor = xor i64 %a0, %b069 %xor1 = xor i64 %xor, %c070 %xor2 = xor i64 %xor1, %d071 %xor3 = xor i64 %xor2, %e072 %xor4 = xor i64 %xor3, %f073 %xor5 = xor i64 %xor4, %g074 %xor6 = xor i64 %xor5, %h075 %xor7 = xor i64 %xor6, %i076 %xor8 = xor i64 %xor7, %j077 %xor9 = xor i64 %xor8, %k078 %xor10 = xor i64 %xor9, %l079 %xor11 = xor i64 %xor10, %m080 %xor12 = xor i64 %xor11, %n081 %xor13 = xor i64 %xor12, %o082 %xor14 = xor i64 %xor13, %p083 %xor15 = xor i64 %xor14, %q084 ret i64 %xor1585}86 87; Calling each (non-)inlining function twice to make sure they won't get the sole call inlining cost bonus. 88define i64 @Caller(ptr noundef %in) {89entry:90 %a0 = getelementptr inbounds i64, ptr %in, i64 091 %b0 = getelementptr inbounds i64, ptr %in, i64 192 %vec0 = insertelement <2 x ptr> undef, ptr %a0, i32 093 %vec1 = insertelement <2 x ptr> %vec0, ptr %b0, i32 094 %c0 = getelementptr inbounds i64, ptr %in, i64 295 %d0 = getelementptr inbounds i64, ptr %in, i64 396 %e0 = getelementptr inbounds i64, ptr %in, i64 497 %f0 = getelementptr inbounds i64, ptr %in, i64 598 %g0 = getelementptr inbounds i64, ptr %in, i64 699 %h0 = getelementptr inbounds i64, ptr %in, i64 7100 %i0 = getelementptr inbounds i64, ptr %in, i64 8101 %j0 = getelementptr inbounds i64, ptr %in, i64 9102 %k0 = getelementptr inbounds i64, ptr %in, i64 10103 %l0 = getelementptr inbounds i64, ptr %in, i64 11104 %m0 = getelementptr inbounds i64, ptr %in, i64 12105 %n0 = getelementptr inbounds i64, ptr %in, i64 13106 %o0 = getelementptr inbounds i64, ptr %in, i64 14107 %p0 = getelementptr inbounds i64, ptr %in, i64 15108 %q0 = getelementptr inbounds i64, ptr %in, i64 16109 %noinlinecall1 = call noundef i64 @non_inlining_call(<2 x ptr> noundef %vec1, ptr noundef %c0, ptr noundef %d0, ptr noundef %e0, ptr noundef %f0, ptr noundef %g0, ptr noundef %h0, ptr noundef %i0, ptr noundef %j0, ptr noundef %k0, ptr noundef %l0, ptr noundef %m0, ptr noundef %n0, ptr noundef %o0, ptr noundef %p0)110 %add = add i64 0, %noinlinecall1111 %noinlinecall2 = call noundef i64 @non_inlining_call(<2 x ptr> noundef %vec1, ptr noundef %c0, ptr noundef %d0, ptr noundef %e0, ptr noundef %f0, ptr noundef %g0, ptr noundef %h0, ptr noundef %i0, ptr noundef %j0, ptr noundef %k0, ptr noundef %l0, ptr noundef %m0, ptr noundef %n0, ptr noundef %o0, ptr noundef %p0)112 %add2 = add i64 %add, %noinlinecall2113 %inlinecall1 = call noundef i64 @inlining_call(<2 x ptr> noundef %vec1, ptr noundef %c0, ptr noundef %d0, ptr noundef %e0, ptr noundef %f0, ptr noundef %g0, ptr noundef %h0, ptr noundef %i0, ptr noundef %j0, ptr noundef %k0, ptr noundef %l0, ptr noundef %m0, ptr noundef %n0, ptr noundef %o0, ptr noundef %p0, ptr noundef %q0)114 %add3 = add i64 %add2, %inlinecall1115 %inlinecall2 = call noundef i64 @inlining_call(<2 x ptr> noundef %vec1, ptr noundef %c0, ptr noundef %d0, ptr noundef %e0, ptr noundef %f0, ptr noundef %g0, ptr noundef %h0, ptr noundef %i0, ptr noundef %j0, ptr noundef %k0, ptr noundef %l0, ptr noundef %m0, ptr noundef %n0, ptr noundef %o0, ptr noundef %p0, ptr noundef %q0)116 %add4 = add i64 %add3, %inlinecall2117 ret i64 %add4118}119