mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-27 16:17:17 +00:00
Move Rewriter.clear() earlier, to avoid triggerring the AssertingVH by
one of the RecursivelyDeleteTriviallyDeadInstructions. Add a comment explaining why the cache needs to be cleared. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72372 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -414,9 +414,12 @@ bool IndVarSimplify::runOnLoop(Loop *L, LPPassManager &LPM) {
|
|||||||
|
|
||||||
Rewriter.setInsertionPoint(Header->getFirstNonPHI());
|
Rewriter.setInsertionPoint(Header->getFirstNonPHI());
|
||||||
|
|
||||||
// Rewrite IV-derived expressions.
|
// Rewrite IV-derived expressions. Clears the rewriter cache.
|
||||||
RewriteIVExpressions(L, LargestType, Rewriter);
|
RewriteIVExpressions(L, LargestType, Rewriter);
|
||||||
|
|
||||||
|
// The Rewriter may only be used for isInsertedInstruction queries from this
|
||||||
|
// point on.
|
||||||
|
|
||||||
// Loop-invariant instructions in the preheader that aren't used in the
|
// Loop-invariant instructions in the preheader that aren't used in the
|
||||||
// loop may be sunk below the loop to reduce register pressure.
|
// loop may be sunk below the loop to reduce register pressure.
|
||||||
SinkUnusedInvariants(L, Rewriter);
|
SinkUnusedInvariants(L, Rewriter);
|
||||||
@@ -424,7 +427,6 @@ bool IndVarSimplify::runOnLoop(Loop *L, LPPassManager &LPM) {
|
|||||||
// Reorder instructions to avoid use-before-def conditions.
|
// Reorder instructions to avoid use-before-def conditions.
|
||||||
FixUsesBeforeDefs(L, Rewriter);
|
FixUsesBeforeDefs(L, Rewriter);
|
||||||
|
|
||||||
Rewriter.clear();
|
|
||||||
// For completeness, inform IVUsers of the IV use in the newly-created
|
// For completeness, inform IVUsers of the IV use in the newly-created
|
||||||
// loop exit test instruction.
|
// loop exit test instruction.
|
||||||
if (NewICmp)
|
if (NewICmp)
|
||||||
@@ -574,6 +576,10 @@ void IndVarSimplify::RewriteIVExpressions(Loop *L, const Type *LargestType,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Clear the rewriter cache, because values that are in the rewriter's cache
|
||||||
|
// can be deleted in the loop below, causing the AssertingVH in the cache to
|
||||||
|
// trigger.
|
||||||
|
Rewriter.clear();
|
||||||
// Now that we're done iterating through lists, clean up any instructions
|
// Now that we're done iterating through lists, clean up any instructions
|
||||||
// which are now dead.
|
// which are now dead.
|
||||||
while (!DeadInsts.empty()) {
|
while (!DeadInsts.empty()) {
|
||||||
|
Reference in New Issue
Block a user