Recommit 132404 with fixes. rdar://problem/5993888
[oota-llvm.git] / lib / Target / Sparc / SparcFrameLowering.cpp
index 1efd707d7fddf048522b84245fa1c7b97d121953..320c8ca26d7e7471951c739edfc62e950c35f69c 100644 (file)
@@ -69,7 +69,7 @@ void SparcFrameLowering::emitPrologue(MachineFunction &MF) const {
 
 void SparcFrameLowering::emitEpilogue(MachineFunction &MF,
                                   MachineBasicBlock &MBB) const {
-  MachineBasicBlock::iterator MBBI = prior(MBB.end());
+  MachineBasicBlock::iterator MBBI = MBB.getLastNonDebugInstr();
   const SparcInstrInfo &TII =
     *static_cast<const SparcInstrInfo*>(MF.getTarget().getInstrInfo());
   DebugLoc dl = MBBI->getDebugLoc();