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,17 +68,8 @@ 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, @@ -98,6 +89,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); diff --git a/llvm/test/Transforms/Inline/always-inline-remark.ll b/llvm/test/Transforms/Inline/always-inline-remark.ll --- a/llvm/test/Transforms/Inline/always-inline-remark.ll +++ b/llvm/test/Transforms/Inline/always-inline-remark.ll @@ -1,4 +1,4 @@ -; RUN: opt -passes="always-inline" -pass-remarks-missed=inline -S < %s 2>&1 | FileCheck %s +; RUN: opt -passes="always-inline" -pass-remarks=inline -pass-remarks-missed=inline -S < %s 2>&1 | FileCheck %s --implicit-check-not="remark: " declare void @personalityFn1(); declare void @personalityFn2(); @@ -12,9 +12,11 @@ } define void @goo() personality void ()* @personalityFn2 { - ; CHECK-DAG: 'bar' is not inlined into 'goo': incompatible personality + ; CHECK-DAG: remark: {{.*}}: 'bar' is not inlined into 'goo': incompatible personality call void @bar() - ; CHECK-DAG: 'foo' is not inlined into 'goo': unsupported operand bundle + ; CHECK-DAG: remark: {{.*}}: 'foo' is not inlined into 'goo': unsupported operand bundle call void @foo() [ "CUSTOM_OPERAND_BUNDLE"() ] + ; CHECK-DAG: remark: {{.*}}: 'foo' inlined into 'goo' with (cost=always): always inline attribute + call void @foo() ret void }