[PATCH] D121722: [AlwaysInliner] Check inliner errors even without assserts
Ellis Hoag via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 15 11:17:49 PDT 2022
ellis created this revision.
Herald added subscribers: ormris, hiraditya.
Herald added a project: All.
ellis retitled this revision from "Check inliner errors checked even without assserts" to "[AlwaysInliner] Check inliner errors even without assserts".
ellis added reviewers: kyulee, aeubanks, Carrot.
ellis published this revision for review.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
When we build clang without asserts we should still check the result of
`InlineFunction()` to be sure there wasn't an error. Otherwise we could
incorrectly merge attributes in the next line.
This also removes a redundent call to `getCaller()`.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D121722
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
@@ -80,13 +80,18 @@
InlineFunctionInfo IFI(
/*cg=*/nullptr, GetAssumptionCache, &PSI,
- &FAM.getResult<BlockFrequencyAnalysis>(*(CB->getCaller())),
+ &FAM.getResult<BlockFrequencyAnalysis>(*Caller),
&FAM.getResult<BlockFrequencyAnalysis>(F));
InlineResult Res = InlineFunction(
*CB, IFI, &FAM.getResult<AAManager>(F), InsertLifetime);
- assert(Res.isSuccess() && "unexpected failure to inline");
- (void)Res;
+ if (!Res.isSuccess()) {
+ llvm::errs() << "Unable to inline " << F.getName() << " at "
+ << Caller->getName() << ": " << Res.getFailureReason()
+ << "\n";
+ assert(false && "unexpected failure to inline");
+ continue;
+ }
// Merge the attributes based on the inlining.
AttributeFuncs::mergeAttributesForInlining(*Caller, F);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D121722.415512.patch
Type: text/x-patch
Size: 1147 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220315/abbf32f1/attachment.bin>
More information about the llvm-commits
mailing list