Skip to content

Commit

Permalink
[MachineSink] Reduce the number of unnecessary invalidations of Store…
Browse files Browse the repository at this point in the history
…InstrCache (NFC) (#68676)

Don't invalidate the cache when erasing instructions which cannot ever
appear in the cache.
  • Loading branch information
momchil-velikov committed Oct 12, 2023
1 parent 3b13e02 commit 2ceabf6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions llvm/lib/CodeGen/MachineSink.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2ceabf6

Please sign in to comment.