[llvm-commits] CVS: llvm/lib/CodeGen/PrologEpilogInserter.cpp

Chris Lattner lattner at cs.uiuc.edu
Sat Feb 14 14:12:16 PST 2004


Changes in directory llvm/lib/CodeGen:

PrologEpilogInserter.cpp updated: 1.19 -> 1.20

---
Log message:

There is no reason to align the stack pointer if there are no callees of this function!


---
Diffs of the changes:  (+5 -2)

Index: llvm/lib/CodeGen/PrologEpilogInserter.cpp
diff -u llvm/lib/CodeGen/PrologEpilogInserter.cpp:1.19 llvm/lib/CodeGen/PrologEpilogInserter.cpp:1.20
--- llvm/lib/CodeGen/PrologEpilogInserter.cpp:1.19	Wed Feb 11 20:27:10 2004
+++ llvm/lib/CodeGen/PrologEpilogInserter.cpp	Sat Feb 14 14:10:59 2004
@@ -216,8 +216,11 @@
     FFI->setObjectOffset(i, -Offset);        // Set the computed offset
   }
 
-  // Align the final stack pointer offset...
-  Offset = (Offset+StackAlignment-1)/StackAlignment*StackAlignment;
+  // Align the final stack pointer offset, but only if there are calls in the
+  // function.  This ensures that any calls to subroutines have their stack
+  // frames suitable aligned.
+  if (FFI->hasCalls())
+    Offset = (Offset+StackAlignment-1)/StackAlignment*StackAlignment;
 
   // Set the final value of the stack pointer...
   FFI->setStackSize(Offset-TFI.getOffsetOfLocalArea());





More information about the llvm-commits mailing list