From: Evan Cheng Date: Thu, 26 Jul 2007 17:45:41 +0000 (+0000) Subject: Make sure epilogue esp adjustment is placed before any terminator and pop instructions. X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=fcc8793dc8b11c1471d7fef8f3d12db919d3123d;p=oota-llvm.git Make sure epilogue esp adjustment is placed before any terminator and pop instructions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40538 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Target/X86/X86RegisterInfo.cpp b/lib/Target/X86/X86RegisterInfo.cpp index 29bdf94a68d..bd4179f3486 100644 --- a/lib/Target/X86/X86RegisterInfo.cpp +++ b/lib/Target/X86/X86RegisterInfo.cpp @@ -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; }