aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2007-07-17 18:03:34 +0000
committerEvan Cheng <evan.cheng@apple.com>2007-07-17 18:03:34 +0000
commitf27795d174d55884098aca07a2bf3f8fe8ba8650 (patch)
tree41b2c75926d37b30b36cdac809b5a3cbc6a3f69f
parent969c44481b0bd7872c04bfb2af994eafd90b63b0 (diff)
downloadexternal_llvm-f27795d174d55884098aca07a2bf3f8fe8ba8650.zip
external_llvm-f27795d174d55884098aca07a2bf3f8fe8ba8650.tar.gz
external_llvm-f27795d174d55884098aca07a2bf3f8fe8ba8650.tar.bz2
Missed the case where alloca is used but the stack size (not including callee-saved portion) is zero. Thanks Dan.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@39974 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Target/X86/X86RegisterInfo.cpp34
1 files changed, 17 insertions, 17 deletions
diff --git a/lib/Target/X86/X86RegisterInfo.cpp b/lib/Target/X86/X86RegisterInfo.cpp
index bbe30b4..fce7172 100644
--- a/lib/Target/X86/X86RegisterInfo.cpp
+++ b/lib/Target/X86/X86RegisterInfo.cpp
@@ -1340,25 +1340,25 @@ void X86RegisterInfo::emitEpilogue(MachineFunction &MF,
addReg(DestAddr.getReg());
}
- if (NumBytes) { // adjust stack pointer back: ESP += numbytes
- // Skip the callee-saved pop instructions.
- while (MBBI != MBB.begin()) {
- MachineBasicBlock::iterator PI = prior(MBBI);
- if (PI->getOpcode() != X86::POP32r && PI->getOpcode() != X86::POP64r)
- break;
- --MBBI;
- }
+ // Skip the callee-saved pop instructions.
+ while (MBBI != MBB.begin()) {
+ MachineBasicBlock::iterator PI = prior(MBBI);
+ if (PI->getOpcode() != X86::POP32r && PI->getOpcode() != X86::POP64r)
+ break;
+ --MBBI;
+ }
- // If dynamic alloca is used, then reset esp to point to the last
- // callee-saved slot before popping them off!
- if (MFI->hasVarSizedObjects()) {
- unsigned Opc = Is64Bit ? X86::LEA64r : X86::LEA32r;
- MachineInstr *MI = addRegOffset(BuildMI(TII.get(Opc), StackPtr),
- FramePtr, -CSSize);
- MBB.insert(MBBI, MI);
- return;
- }
+ // If dynamic alloca is used, then reset esp to point to the last
+ // callee-saved slot before popping them off!
+ if (MFI->hasVarSizedObjects()) {
+ unsigned Opc = Is64Bit ? X86::LEA64r : X86::LEA32r;
+ MachineInstr *MI = addRegOffset(BuildMI(TII.get(Opc), StackPtr),
+ FramePtr, -CSSize);
+ MBB.insert(MBBI, MI);
+ return;
+ }
+ if (NumBytes) { // adjust stack pointer back: ESP += numbytes
// If there is an ADD32ri or SUB32ri of ESP immediately before this
// instruction, merge the two instructions.
if (MBBI != MBB.begin()) {