mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-20 03:23:01 +02:00
Incorporated feedback: Check that the implicitly defined operands aren't used
before deleting the instruction. llvm-svn: 51609
This commit is contained in:
parent
92d5dff525
commit
e5d738e779
@ -373,6 +373,8 @@ bool TwoAddressInstructionPass::runOnMachineFunction(MachineFunction &MF) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (EnableReMat) {
|
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 I = ReMattedInstrs.begin();
|
||||||
SmallPtrSet<MachineInstr*, 8>::iterator E = ReMattedInstrs.end();
|
SmallPtrSet<MachineInstr*, 8>::iterator E = ReMattedInstrs.end();
|
||||||
|
|
||||||
@ -385,20 +387,17 @@ bool TwoAddressInstructionPass::runOnMachineFunction(MachineFunction &MF) {
|
|||||||
if (!MO.isRegister())
|
if (!MO.isRegister())
|
||||||
continue;
|
continue;
|
||||||
unsigned MOReg = MO.getReg();
|
unsigned MOReg = MO.getReg();
|
||||||
if (!MOReg)
|
|
||||||
continue;
|
|
||||||
if (MO.isDef()) {
|
|
||||||
if (MO.isImplicit())
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (MRI->use_begin(MOReg) != MRI->use_end()) {
|
if (!MOReg || !MO.isDef() || (MO.isImplicit() && MO.isDead()))
|
||||||
InstrDead = false;
|
continue;
|
||||||
break;
|
|
||||||
}
|
if (MRI->use_begin(MOReg) != MRI->use_end()) {
|
||||||
|
InstrDead = false;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (InstrDead && MI->getNumOperands() > 0)
|
if (InstrDead)
|
||||||
MI->eraseFromParent();
|
MI->eraseFromParent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user