mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-28 03:25:23 +00:00
[Cleanup] Utility function to erase instruction and mark DBG_Values
New function to erase a machine instruction and mark DBG_VALUE for removal. A DBG_VALUE is marked for removal when it references an operand defined in the instruction. Use the new function to cleanup code in dead machine instruction removal pass. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215580 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -124,19 +124,10 @@ bool DeadMachineInstructionElim::runOnMachineFunction(MachineFunction &MF) {
|
||||
if (isDead(MI)) {
|
||||
DEBUG(dbgs() << "DeadMachineInstructionElim: DELETING: " << *MI);
|
||||
// It is possible that some DBG_VALUE instructions refer to this
|
||||
// instruction. Examine each def operand for such references;
|
||||
// if found, mark the DBG_VALUE as undef (but don't delete it).
|
||||
for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) {
|
||||
const MachineOperand &MO = MI->getOperand(i);
|
||||
if (!MO.isReg() || !MO.isDef())
|
||||
continue;
|
||||
unsigned Reg = MO.getReg();
|
||||
if (!TargetRegisterInfo::isVirtualRegister(Reg))
|
||||
continue;
|
||||
MRI->markUsesInDebugValueAsUndef(Reg);
|
||||
}
|
||||
// instruction. They get marked as undef and will be deleted
|
||||
// in the live debug variable analysis.
|
||||
MI->eraseFromParentAndMarkDBGValuesForRemoval();
|
||||
AnyChanges = true;
|
||||
MI->eraseFromParent();
|
||||
++NumDeletes;
|
||||
MIE = MBB->rend();
|
||||
// MII is now pointing to the next instruction to process,
|
||||
|
Reference in New Issue
Block a user