[llvm-commits] [llvm] r39974 - /llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp

Evan Cheng evan.cheng at apple.com
Tue Jul 17 11:03:34 PDT 2007


Author: evancheng
Date: Tue Jul 17 13:03:34 2007
New Revision: 39974

URL: http://llvm.org/viewvc/llvm-project?rev=39974&view=rev
Log:
Missed the case where alloca is used but the stack size (not including callee-saved portion) is zero. Thanks Dan.

Modified:
    llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp

Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp?rev=39974&r1=39973&r2=39974&view=diff

==============================================================================
--- llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Tue Jul 17 13:03:34 2007
@@ -1340,25 +1340,25 @@
       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()) {





More information about the llvm-commits mailing list