aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/MachineSink.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/CodeGen/MachineSink.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineSink.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/MachineSink.cpp b/llvm/lib/CodeGen/MachineSink.cpp
index 9a0d1cc..d0e119c 100644
--- a/llvm/lib/CodeGen/MachineSink.cpp
+++ b/llvm/lib/CodeGen/MachineSink.cpp
@@ -539,9 +539,10 @@ bool MachineSinking::PerformSinkAndFold(MachineInstr &MI,
New = TII->emitLdStWithAddr(*SinkDst, MaybeAM);
}
LLVM_DEBUG(dbgs() << "yielding"; New->dump());
+ // Clear the StoreInstrCache, since we may invalidate it by erasing.
+ if (SinkDst->mayStore() && !SinkDst->hasOrderedMemoryRef())
+ StoreInstrCache.clear();
SinkDst->eraseFromParent();
- // Clear the StoreInstrCache, since we may have invalidated it by erasing.
- StoreInstrCache.clear();
}
// Collect operands that need to be cleaned up because the registers no longer