diff options
author | Momchil Velikov <momchil.velikov@arm.com> | 2023-10-12 10:06:19 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-12 10:06:19 +0100 |
commit | 2ceabf6bdc649f06a316f917a0f508fe10ea7faa (patch) | |
tree | cc187b25ea4ef3dc25d62ce8c64a9d4f7a1a2b8f /llvm/lib/CodeGen/MachineSink.cpp | |
parent | 3b13e02d6d3248050d29fc73b22705b0ffda0f48 (diff) | |
download | llvm-2ceabf6bdc649f06a316f917a0f508fe10ea7faa.zip llvm-2ceabf6bdc649f06a316f917a0f508fe10ea7faa.tar.gz llvm-2ceabf6bdc649f06a316f917a0f508fe10ea7faa.tar.bz2 |
[MachineSink] Reduce the number of unnecessary invalidations of StoreInstrCache (NFC) (#68676)
Don't invalidate the cache when erasing instructions which cannot ever
appear in the cache.
Diffstat (limited to 'llvm/lib/CodeGen/MachineSink.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachineSink.cpp | 5 |
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 |