diff options
author | Vikram S. Adve <vadve@cs.uiuc.edu> | 2002-09-27 14:27:37 +0000 |
---|---|---|
committer | Vikram S. Adve <vadve@cs.uiuc.edu> | 2002-09-27 14:27:37 +0000 |
commit | d238de02c7a740bcf08d516c96611a558fe27d40 (patch) | |
tree | 8e1fe2d0843af8114efad1d8161e773e19c60fa9 /llvm/lib | |
parent | 66303bb9a5c72bbc0650d073f8c054d1f92d9337 (diff) | |
download | bcm5719-llvm-d238de02c7a740bcf08d516c96611a558fe27d40.tar.gz bcm5719-llvm-d238de02c7a740bcf08d516c96611a558fe27d40.zip |
Bug fix: some redundant copies were not being deleted after detection :-|.
llvm-svn: 3959
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Target/Sparc/PeepholeOpts.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/llvm/lib/Target/Sparc/PeepholeOpts.cpp b/llvm/lib/Target/Sparc/PeepholeOpts.cpp index ee749efe8eb..fb83cbbe8e0 100644 --- a/llvm/lib/Target/Sparc/PeepholeOpts.cpp +++ b/llvm/lib/Target/Sparc/PeepholeOpts.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 ********************/ |