mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-11-04 06:09:05 +00:00
Remove DBG_VALUE which reference dead stack slots.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102654 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
a83ce98d5f
commit
bd6cb4ba1f
@ -1066,6 +1066,7 @@ class LocalRewriter : public VirtRegRewriter {
|
||||
VirtRegMap *VRM;
|
||||
BitVector AllocatableRegs;
|
||||
DenseMap<MachineInstr*, unsigned> DistanceMap;
|
||||
DenseMap<int, SmallVector<MachineInstr*,4> > Slot2DbgValues;
|
||||
|
||||
MachineBasicBlock *MBB; // Basic block currently being processed.
|
||||
|
||||
@ -1190,12 +1191,24 @@ bool LocalRewriter::runOnMachineFunction(MachineFunction &MF, VirtRegMap &vrm,
|
||||
// Mark unused spill slots.
|
||||
MachineFrameInfo *MFI = MF.getFrameInfo();
|
||||
int SS = VRM->getLowSpillSlot();
|
||||
if (SS != VirtRegMap::NO_STACK_SLOT)
|
||||
for (int e = VRM->getHighSpillSlot(); SS <= e; ++SS)
|
||||
if (SS != VirtRegMap::NO_STACK_SLOT) {
|
||||
for (int e = VRM->getHighSpillSlot(); SS <= e; ++SS) {
|
||||
SmallVector<MachineInstr*, 4> &DbgValues = Slot2DbgValues[SS];
|
||||
if (!VRM->isSpillSlotUsed(SS)) {
|
||||
MFI->RemoveStackObject(SS);
|
||||
for (unsigned j = 0, ee = DbgValues.size(); j != ee; ++j) {
|
||||
MachineInstr *DVMI = DbgValues[j];
|
||||
MachineBasicBlock *DVMBB = DVMI->getParent();
|
||||
DEBUG(dbgs() << "Removing debug info referencing FI#" << SS << '\n');
|
||||
VRM->RemoveMachineInstrFromMaps(DVMI);
|
||||
DVMBB->erase(DVMI);
|
||||
}
|
||||
++NumDSS;
|
||||
}
|
||||
DbgValues.clear();
|
||||
}
|
||||
}
|
||||
Slot2DbgValues.clear();
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -1905,6 +1918,10 @@ LocalRewriter::RewriteMBB(LiveIntervals *LIs,
|
||||
bool BackTracked = false;
|
||||
MachineInstr &MI = *MII;
|
||||
|
||||
// Remember DbgValue's which reference stack slots.
|
||||
if (MI.isDebugValue() && MI.getOperand(0).isFI())
|
||||
Slot2DbgValues[MI.getOperand(0).getIndex()].push_back(&MI);
|
||||
|
||||
/// ReusedOperands - Keep track of operand reuse in case we need to undo
|
||||
/// reuse.
|
||||
ReuseInfo ReusedOperands(MI, TRI);
|
||||
|
Loading…
Reference in New Issue
Block a user