Fix problems with empty basic blocks

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5326 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2003-01-16 18:06:43 +00:00
parent 6d40c191ee
commit 0416d2a70a
3 changed files with 16 additions and 12 deletions

View File

@ -221,7 +221,7 @@ void PEI::insertPrologEpilogCode(MachineFunction &Fn) {
const TargetInstrInfo &TII = Fn.getTarget().getInstrInfo();
for (MachineFunction::iterator I = Fn.begin(), E = Fn.end(); I != E; ++I) {
// If last instruction is a return instruction, add an epilogue
if (TII.isReturn(I->back()->getOpcode()))
if (!I->empty() && TII.isReturn(I->back()->getOpcode()))
Fn.getTarget().getRegisterInfo()->emitEpilogue(Fn, *I);
}
}