summaryrefslogtreecommitdiff
path: root/lib/CodeGen/PrologEpilogInserter.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-02-14 20:10:59 +0000
committerChris Lattner <sabre@nondot.org>2004-02-14 20:10:59 +0000
commit93799292c1c04c53ff077a427737b3ffbd0445ab (patch)
tree85dfda17c270a84b7f8740646c216e3b72f28055 /lib/CodeGen/PrologEpilogInserter.cpp
parentbb07ef97cfbe88eb5d69784acab5f36815738881 (diff)
downloadllvm-93799292c1c04c53ff077a427737b3ffbd0445ab.tar.gz
llvm-93799292c1c04c53ff077a427737b3ffbd0445ab.tar.bz2
llvm-93799292c1c04c53ff077a427737b3ffbd0445ab.tar.xz
There is no reason to align the stack pointer if there are no callees of this function!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11449 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/PrologEpilogInserter.cpp')
-rw-r--r--lib/CodeGen/PrologEpilogInserter.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/CodeGen/PrologEpilogInserter.cpp b/lib/CodeGen/PrologEpilogInserter.cpp
index 8f34cf48ad..bf1726d6ed 100644
--- a/lib/CodeGen/PrologEpilogInserter.cpp
+++ b/lib/CodeGen/PrologEpilogInserter.cpp
@@ -216,8 +216,11 @@ void PEI::calculateFrameObjectOffsets(MachineFunction &Fn) {
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());