[PATCH] D121946: [AlwaysInliner] Emit inline remark only when successful
Ellis Hoag via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 17 13:15:35 PDT 2022
ellis created this revision.
Herald added subscribers: ormris, hiraditya.
Herald added a project: All.
ellis edited the summary of this revision.
ellis edited the summary of this revision.
ellis updated this revision to Diff 416298.
ellis added a comment.
ellis added reviewers: kyulee, nikic, lebedev.ri.
ellis published this revision for review.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Remove whitespace change
Failures in `InlineFunction()` are caught after D121722 <https://reviews.llvm.org/D121722>, but `emitInlinedIntoBasedOnCost()` should only be called when inlining is successful. This also removes an unnecessary call to `shouldInline()` which always returned `InlineCost::getAlways()`.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D121946
Files:
llvm/lib/Transforms/IPO/AlwaysInliner.cpp
Index: llvm/lib/Transforms/IPO/AlwaysInliner.cpp
===================================================================
--- llvm/lib/Transforms/IPO/AlwaysInliner.cpp
+++ 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);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D121946.416298.patch
Type: text/x-patch
Size: 1255 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220317/4cdc166c/attachment.bin>
More information about the llvm-commits
mailing list