aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVikram S. Adve <vadve@cs.uiuc.edu>2002-09-27 14:27:37 +0000
committerVikram S. Adve <vadve@cs.uiuc.edu>2002-09-27 14:27:37 +0000
commit7e5167a3e2443db63ad7382c32638d84d9fec270 (patch)
tree3ac2794acb92e1ad6d652816af9ff68ec41fdf83
parent1c10f17552c4794d65c8d0019a4111b367518be6 (diff)
Bug fix: some redundant copies were not being deleted after detection :-|.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3959 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Target/SparcV9/SparcV9PeepholeOpts.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/lib/Target/SparcV9/SparcV9PeepholeOpts.cpp b/lib/Target/SparcV9/SparcV9PeepholeOpts.cpp
index ee749efe8e..fb83cbbe8e 100644
--- a/lib/Target/SparcV9/SparcV9PeepholeOpts.cpp
+++ b/lib/Target/SparcV9/SparcV9PeepholeOpts.cpp
@@ -30,23 +30,25 @@ DeleteInstruction(MachineCodeForBasicBlock& mvec,
const TargetMachine& target)
{
// Check if this instruction is in a delay slot of its predecessor.
- // If so, replace this instruction with a nop, else just delete it.
- // By replacing in place, we save having to update the I-I maps.
if (BBI != mvec.begin())
{
const MachineInstrInfo& mii = target.getInstrInfo();
MachineInstr* predMI = *(BBI-1);
if (unsigned ndelay = mii.getNumDelaySlots(predMI->getOpCode()))
{
+ // This instruction is in a delay slot of its predecessor, so
+ // replace it with a nop. By replacing in place, we save having
+ // to update the I-I maps.
+ //
assert(ndelay == 1 && "Not yet handling multiple-delay-slot targets");
(*BBI)->replace(mii.getNOPOpCode(), 0);
+ return;
}
}
- else
- {
- mvec.erase(BBI);
- BBI = mvec.end();
- }
+
+ // The instruction is not in a delay slot, so we can simply erase it.
+ mvec.erase(BBI);
+ BBI = mvec.end();
}
//******************* Individual Peephole Optimizations ********************/