Don't add the same MI to register reuse "last def/use" twice if it reads the

register more than once.

llvm-svn: 35513
This commit is contained in:
Evan Cheng 2007-03-30 20:21:35 +00:00
parent 48dd5e7d44
commit 9a2a7b174a
1 changed files with 4 additions and 1 deletions

View File

@ -316,7 +316,9 @@ public:
assert(II != SpillSlotsAvailable.end() && "Slot not available!"); assert(II != SpillSlotsAvailable.end() && "Slot not available!");
unsigned Val = II->second.first; unsigned Val = II->second.first;
assert((Val >> 1) == PhysReg && "Bidirectional map mismatch!"); assert((Val >> 1) == PhysReg && "Bidirectional map mismatch!");
II->second.second.push_back(Use); // This can be true if there are multiple uses of the same register.
if (II->second.second.back() != Use)
II->second.second.push_back(Use);
} }
} }
@ -1117,6 +1119,7 @@ void LocalSpiller::RewriteMBB(MachineBasicBlock &MBB, VirtRegMap &VRM,
if (TII->isMoveInstr(MI, Src, Dst) && Src == Dst) { if (TII->isMoveInstr(MI, Src, Dst) && Src == Dst) {
++NumDCE; ++NumDCE;
DOUT << "Removing now-noop copy: " << MI; DOUT << "Removing now-noop copy: " << MI;
Spills.removeLastUse(Src, &MI);
MBB.erase(&MI); MBB.erase(&MI);
VRM.RemoveFromFoldedVirtMap(&MI); VRM.RemoveFromFoldedVirtMap(&MI);
goto ProcessNextInst; goto ProcessNextInst;