[llvm-commits] [llvm] r51609 - /llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp
Bill Wendling
isanbard at gmail.com
Tue May 27 13:40:52 PDT 2008
Author: void
Date: Tue May 27 15:40:52 2008
New Revision: 51609
URL: http://llvm.org/viewvc/llvm-project?rev=51609&view=rev
Log:
Incorporated feedback: Check that the implicitly defined operands aren't used
before deleting the instruction.
Modified:
llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp
Modified: llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp?rev=51609&r1=51608&r2=51609&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp (original)
+++ llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp Tue May 27 15:40:52 2008
@@ -373,6 +373,8 @@
}
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();
@@ -385,20 +387,17 @@
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();
}
}
More information about the llvm-commits
mailing list