X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FTarget%2FSparcV9%2FSparcV9PeepholeOpts.cpp;h=fb83cbbe8e0d80d0ec807410cd3118b6cc4580a5;hb=9d67cd1468fa99bf98c52d85a9462f18e63133f3;hp=ee749efe8eba781990cbb004d9b2a6adb7b2553c;hpb=25d80cdcc68080342aa65c037a4e9ebc67d3e256;p=oota-llvm.git diff --git a/lib/Target/SparcV9/SparcV9PeepholeOpts.cpp b/lib/Target/SparcV9/SparcV9PeepholeOpts.cpp index ee749efe8eb..fb83cbbe8e0 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 ********************/