[PATCH] D34823: [PredicateInfo] Invalidate an OrderedBasicBlock when instruction in it is deleted.
Xin Tong via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 29 11:18:23 PDT 2017
trentxintong created this revision.
Herald added a subscriber: Prazek.
PredicateInfo uses OrderedBasicBlock and NewGVN which uses PredicateInfo should keep
it updated and correct.
https://reviews.llvm.org/D34823
Files:
include/llvm/Transforms/Utils/PredicateInfo.h
lib/Transforms/Scalar/NewGVN.cpp
Index: lib/Transforms/Scalar/NewGVN.cpp
===================================================================
--- lib/Transforms/Scalar/NewGVN.cpp
+++ lib/Transforms/Scalar/NewGVN.cpp
@@ -3174,8 +3174,10 @@
if (!ToErase->use_empty())
ToErase->replaceAllUsesWith(UndefValue::get(ToErase->getType()));
- if (ToErase->getParent())
+ if (ToErase->getParent()) {
+ PredInfo->updateErasedInst(ToErase);
ToErase->eraseFromParent();
+ }
}
// Delete all unreachable blocks.
Index: include/llvm/Transforms/Utils/PredicateInfo.h
===================================================================
--- include/llvm/Transforms/Utils/PredicateInfo.h
+++ include/llvm/Transforms/Utils/PredicateInfo.h
@@ -221,6 +221,13 @@
return PredicateMap.lookup(V);
}
+ // Inform the PredicateInfo analysis when an instruction is deleted
+ // in the function.
+ void updateErasedInst(const Instruction *Inst) {
+ // Need to invalidate the ordered basicblock for the instruction.
+ OI.invalidateBlock(Inst->getParent());
+ }
+
protected:
// Used by PredicateInfo annotater, dumpers, and wrapper pass.
friend class PredicateInfoAnnotatedWriter;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D34823.104698.patch
Type: text/x-patch
Size: 1183 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170629/47ade2b0/attachment.bin>
More information about the llvm-commits
mailing list