diff --git a/llvm/lib/Transforms/IPO/AlwaysInliner.cpp b/llvm/lib/Transforms/IPO/AlwaysInliner.cpp --- a/llvm/lib/Transforms/IPO/AlwaysInliner.cpp +++ b/llvm/lib/Transforms/IPO/AlwaysInliner.cpp @@ -68,23 +68,13 @@ for (CallBase *CB : Calls) { Function *Caller = CB->getCaller(); OptimizationRemarkEmitter ORE(Caller); - auto OIC = shouldInline( - *CB, - [&](CallBase &CB) { - return InlineCost::getAlways("always inline attribute"); - }, - ORE); - assert(OIC); DebugLoc DLoc = CB->getDebugLoc(); BasicBlock *Block = CB->getParent(); - emitInlinedIntoBasedOnCost(ORE, DLoc, Block, F, *Caller, *OIC, false, - DEBUG_TYPE); InlineFunctionInfo IFI( /*cg=*/nullptr, GetAssumptionCache, &PSI, &FAM.getResult(*Caller), &FAM.getResult(F)); - InlineResult Res = InlineFunction( *CB, IFI, &FAM.getResult(F), InsertLifetime); if (!Res.isSuccess()) { @@ -98,6 +88,11 @@ continue; } + emitInlinedIntoBasedOnCost( + ORE, DLoc, Block, F, *Caller, + InlineCost::getAlways("always inline attribute"), + /*ForProfileContext=*/false, DEBUG_TYPE); + // Merge the attributes based on the inlining. AttributeFuncs::mergeAttributesForInlining(*Caller, F);