forked from OSchip/llvm-project
Fix memory leak reported by valgrind.
Do not visit operands of old instruction. Visit all operands of new instruction. llvm-svn: 108767
This commit is contained in:
parent
428a7103d9
commit
d61b735d25
|
@ -753,6 +753,9 @@ void RAFast::AllocateBasicBlock() {
|
|||
|
||||
// Debug values are not allowed to change codegen in any way.
|
||||
if (MI->isDebugValue()) {
|
||||
bool ScanDbgValue = true;
|
||||
while (ScanDbgValue) {
|
||||
ScanDbgValue = false;
|
||||
for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) {
|
||||
MachineOperand &MO = MI->getOperand(i);
|
||||
if (!MO.isReg()) continue;
|
||||
|
@ -776,11 +779,16 @@ void RAFast::AllocateBasicBlock() {
|
|||
DEBUG(dbgs() << "Modifying debug info due to spill:" << "\t" << *MI);
|
||||
MachineBasicBlock *MBB = MI->getParent();
|
||||
MBB->insert(MBB->erase(MI), NewDV);
|
||||
// Scan NewDV operands from the beginning.
|
||||
MI = NewDV;
|
||||
ScanDbgValue = true;
|
||||
break;
|
||||
} else
|
||||
MO.setReg(0); // We can't allocate a physreg for a DebugValue, sorry!
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Next instruction.
|
||||
continue;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue