diff options
author | Reid Kleckner <reid@kleckner.net> | 2014-08-06 17:57:23 +0000 |
---|---|---|
committer | Reid Kleckner <reid@kleckner.net> | 2014-08-06 17:57:23 +0000 |
commit | e41d957028ddf5ff6fdd96c99f6a7fd9afa2358b (patch) | |
tree | 747685a7b56288836830e59078bea6c8bcebc91d /llvm/lib/CodeGen/CallingConvLower.cpp | |
parent | 04642a4972135e869615ab12c5debcf7a9956016 (diff) | |
download | bcm5719-llvm-e41d957028ddf5ff6fdd96c99f6a7fd9afa2358b.tar.gz bcm5719-llvm-e41d957028ddf5ff6fdd96c99f6a7fd9afa2358b.zip |
Round up the size of byval arguments to MinAlign
Otherwise we can end up with an argument frame size that is not a
multiple of stack slot size, which is very awkward.
This fixes PR20547, which was a bug in x86_64 Sys V vararg handling.
However, it's much easier to test this with x86 callee-cleanup
functions, which previously ended in "retl $6" instead of "retl $8".
This does affect behavior of all backends, but it presumably fixes the
same bug in all of them.
llvm-svn: 214980
Diffstat (limited to 'llvm/lib/CodeGen/CallingConvLower.cpp')
-rw-r--r-- | llvm/lib/CodeGen/CallingConvLower.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/CallingConvLower.cpp b/llvm/lib/CodeGen/CallingConvLower.cpp index 50fc6a179b6..cfcc9eae14e 100644 --- a/llvm/lib/CodeGen/CallingConvLower.cpp +++ b/llvm/lib/CodeGen/CallingConvLower.cpp @@ -52,6 +52,7 @@ void CCState::HandleByVal(unsigned ValNo, MVT ValVT, Align = MinAlign; MF.getFrameInfo()->ensureMaxAlignment(Align); TM.getSubtargetImpl()->getTargetLowering()->HandleByVal(this, Size, Align); + Size = unsigned(RoundUpToAlignment(Size, MinAlign)); unsigned Offset = AllocateStack(Size, Align); addLoc(CCValAssign::getMem(ValNo, ValVT, Offset, LocVT, LocInfo)); } |