}
if (EnableReMat) {
+ // Check to see if the instructions that we rematerialized are now dead. If
+ // they are, expunge them here.
SmallPtrSet<MachineInstr*, 8>::iterator I = ReMattedInstrs.begin();
SmallPtrSet<MachineInstr*, 8>::iterator E = ReMattedInstrs.end();
if (!MO.isRegister())
continue;
unsigned MOReg = MO.getReg();
- if (!MOReg)
+
+ if (!MOReg || !MO.isDef() || (MO.isImplicit() && MO.isDead()))
continue;
- if (MO.isDef()) {
- if (MO.isImplicit())
- continue;
- if (MRI->use_begin(MOReg) != MRI->use_end()) {
- InstrDead = false;
- break;
- }
+ if (MRI->use_begin(MOReg) != MRI->use_end()) {
+ InstrDead = false;
+ break;
}
}
- if (InstrDead && MI->getNumOperands() > 0)
+ if (InstrDead)
MI->eraseFromParent();
}
}