Make sure epilogue esp adjustment is placed before any terminator and pop instructions.
authorEvan Cheng <evan.cheng@apple.com>
Thu, 26 Jul 2007 17:45:41 +0000 (17:45 +0000)
committerEvan Cheng <evan.cheng@apple.com>
Thu, 26 Jul 2007 17:45:41 +0000 (17:45 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40538 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/X86/X86RegisterInfo.cpp

index 29bdf94a68d6a8f572b770641967b0c2599a6d62..bd4179f34866ef827d271177b3969221a2b25dc7 100644 (file)
@@ -1372,8 +1372,9 @@ void X86RegisterInfo::emitEpilogue(MachineFunction &MF,
 
   // Skip the callee-saved pop instructions.
   while (MBBI != MBB.begin()) {
-    MachineBasicBlock::iterator PI = prior(MBBI);      
-    if (PI->getOpcode() != X86::POP32r && PI->getOpcode() != X86::POP64r)
+    MachineBasicBlock::iterator PI = prior(MBBI);
+    unsigned Opc = PI->getOpcode();
+    if (Opc != X86::POP32r && Opc != X86::POP64r && !TII.isTerminatorInstr(Opc))
       break;
     --MBBI;
   }