[PATCH] D79458: [AssumeBundles] fix crashes
Tyker via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue May 5 17:17:22 PDT 2020
Tyker created this revision.
Tyker added a reviewer: jdoerfert.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.
this patch fixe crash/asserts found in the test-suite.
the AssumeptionCache cannot be assumed to have all assumes contrary to what i tought.
prevent generation of information for terminators, because this can create broken IR in transfromation where we insert the new terminator before removing the old one.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D79458
Files:
llvm/lib/Analysis/AssumeBundleQueries.cpp
llvm/lib/Transforms/Utils/AssumeBundleBuilder.cpp
Index: llvm/lib/Transforms/Utils/AssumeBundleBuilder.cpp
===================================================================
--- llvm/lib/Transforms/Utils/AssumeBundleBuilder.cpp
+++ llvm/lib/Transforms/Utils/AssumeBundleBuilder.cpp
@@ -202,7 +202,7 @@
void llvm::salvageKnowledge(Instruction *I, AssumptionCache *AC,
DominatorTree *DT) {
- if (!EnableKnowledgeRetention)
+ if (!EnableKnowledgeRetention || I->isTerminator())
return;
AssumeBuilderState Builder(I->getModule(), I, AC, DT);
Builder.addInstruction(I);
Index: llvm/lib/Analysis/AssumeBundleQueries.cpp
===================================================================
--- llvm/lib/Analysis/AssumeBundleQueries.cpp
+++ llvm/lib/Analysis/AssumeBundleQueries.cpp
@@ -152,10 +152,6 @@
const CallBase::BundleOpInfo *)>
Filter) {
if (AC) {
-#ifndef NDEBUG
- RetainedKnowledge RKCheck =
- getKnowledgeForValue(V, AttrKinds, nullptr, Filter);
-#endif
for (AssumptionCache::ResultElem &Elem : AC->assumptionsFor(V)) {
IntrinsicInst *II = cast_or_null<IntrinsicInst>(Elem.Assume);
if (!II || Elem.Index == AssumptionCache::ExprResultIdx)
@@ -163,12 +159,9 @@
if (RetainedKnowledge RK = getKnowledgeFromBundle(
*II, II->bundle_op_info_begin()[Elem.Index]))
if (is_contained(AttrKinds, RK.AttrKind) &&
- Filter(RK, II, &II->bundle_op_info_begin()[Elem.Index])) {
- assert(!!RKCheck && "invalid Assumption cache");
+ Filter(RK, II, &II->bundle_op_info_begin()[Elem.Index]))
return RK;
- }
}
- assert(!RKCheck && "invalid Assumption cache");
return RetainedKnowledge::none();
}
for (auto &U : V->uses()) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D79458.262263.patch
Type: text/x-patch
Size: 1811 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200506/b086b3bf/attachment-0001.bin>
More information about the llvm-commits
mailing list