Skip to content

Commit 2ceabf6

Browse files
[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.
1 parent 3b13e02 commit 2ceabf6

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

llvm/lib/CodeGen/MachineSink.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -539,9 +539,10 @@ bool MachineSinking::PerformSinkAndFold(MachineInstr &MI,
539539
New = TII->emitLdStWithAddr(*SinkDst, MaybeAM);
540540
}
541541
LLVM_DEBUG(dbgs() << "yielding"; New->dump());
542+
// Clear the StoreInstrCache, since we may invalidate it by erasing.
543+
if (SinkDst->mayStore() && !SinkDst->hasOrderedMemoryRef())
544+
StoreInstrCache.clear();
542545
SinkDst->eraseFromParent();
543-
// Clear the StoreInstrCache, since we may have invalidated it by erasing.
544-
StoreInstrCache.clear();
545546
}
546547

547548
// Collect operands that need to be cleaned up because the registers no longer

0 commit comments

Comments
 (0)