summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/PrologEpilogInserter.cpp
diff options
context:
space:
mode:
authorDale Johannesen <dalej@apple.com>2008-06-26 01:51:13 +0000
committerDale Johannesen <dalej@apple.com>2008-06-26 01:51:13 +0000
commita2de8eab618f57b70e2374f56f2b1141a9cfa1de (patch)
tree8214ac401a5c56b7524b24b572ef7b9556459319 /llvm/lib/CodeGen/PrologEpilogInserter.cpp
parent3f1c75c4d816f04e96aeb82f13d2acee86d21880 (diff)
downloadbcm5719-llvm-a2de8eab618f57b70e2374f56f2b1141a9cfa1de.tar.gz
bcm5719-llvm-a2de8eab618f57b70e2374f56f2b1141a9cfa1de.zip
Fixes the last x86-64 test failure in compat.exp:
<16 x float> is 64-byte aligned (for some reason), which gets us into the stack realignment code. The computation changing FP-relative offsets to SP-relative was broken, assiging a spill temp to a location also used for parameter passing. This fixes it by rounding up the stack frame to a multiple of the largest alignment (I concluded it wasn't fixable without doing this, but I'm not very sure.) llvm-svn: 52750
Diffstat (limited to 'llvm/lib/CodeGen/PrologEpilogInserter.cpp')
-rw-r--r--llvm/lib/CodeGen/PrologEpilogInserter.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/PrologEpilogInserter.cpp b/llvm/lib/CodeGen/PrologEpilogInserter.cpp
index c52da321c1e..10ba9c0256f 100644
--- a/llvm/lib/CodeGen/PrologEpilogInserter.cpp
+++ b/llvm/lib/CodeGen/PrologEpilogInserter.cpp
@@ -459,15 +459,19 @@ void PEI::calculateFrameObjectOffsets(MachineFunction &Fn) {
// Round up the size to a multiple of the alignment, but only if there are
// calls or alloca's in the function. This ensures that any calls to
// subroutines have their stack frames suitable aligned.
+ // Also do this if we need runtime alignment of the stack. In this case
+ // offsets will be relative to SP not FP; round up the stack size so this
+ // works.
if (!RegInfo->targetHandlesStackFrameRounding() &&
- (FFI->hasCalls() || FFI->hasVarSizedObjects())) {
+ (FFI->hasCalls() || FFI->hasVarSizedObjects() ||
+ RegInfo->needsStackRealignment(Fn))) {
// If we have reserved argument space for call sites in the function
// immediately on entry to the current function, count it as part of the
// overall stack size.
if (RegInfo->hasReservedCallFrame(Fn))
Offset += FFI->getMaxCallFrameSize();
- unsigned AlignMask = TFI.getStackAlignment() - 1;
+ unsigned AlignMask = std::max(TFI.getStackAlignment(),MaxAlign) - 1;
Offset = (Offset + AlignMask) & ~uint64_t(AlignMask);
}
OpenPOWER on IntegriCloud