[llvm] [MachineLateInstrsCleanup] Handle multiple kills for a preceding definition. (PR #119132)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Sun Dec 8 12:31:50 PST 2024
================
@@ -113,33 +113,39 @@ bool MachineLateInstrsCleanup::runOnMachineFunction(MachineFunction &MF) {
// definition.
void MachineLateInstrsCleanup::clearKillsForDef(Register Reg,
MachineBasicBlock *MBB,
- BitVector &VisitedPreds) {
+ BitVector &VisitedPreds,
+ MachineInstr *ToRemoveMI) {
VisitedPreds.set(MBB->getNumber());
- // Kill flag in MBB
- if (MachineInstr *KillMI = RegKills[MBB->getNumber()].lookup(Reg)) {
- KillMI->clearRegisterKills(Reg, TRI);
- return;
- }
+ // Clear kill flag(s) in MBB, that have been seen after the preceding
+ // definition. If Reg or one of its subregs was killed, it would actually
+ // be ok to stop after removing that (and any other) kill-flag, but it
+ // doesn't seem noticeably faster while it would be a bit more complicated.
+ Reg2MIVecMap &MBBKills = RegKills[MBB->getNumber()];
+ if (MBBKills.contains(Reg))
+ for (auto *KillMI : MBBKills[Reg])
+ KillMI->clearRegisterKills(Reg, TRI);
----------------
arsenm wrote:
Double map lookup
https://github.com/llvm/llvm-project/pull/119132
More information about the llvm-commits
mailing list