OSDN Git Service

Always align the stack to the fixed alloca requirements.
authorNicolas Capens <capn@google.com>
Wed, 14 Dec 2016 22:37:10 +0000 (17:37 -0500)
committerNicolas Capens <nicolascapens@google.com>
Tue, 17 Jan 2017 18:39:55 +0000 (18:39 +0000)
commita551dfce9bd44034b4fd588cd4b06b3b0435df8d
tree14734aeb86dd08826b81b47e9ee8b784ada1522c
parent298d14e243e0a83abf89bc9d1d29cc95905b0236
Always align the stack to the fixed alloca requirements.

Local variables that use a fixed alloca stack slot are assigned offsets
starting at 0, before the prolog is written. Therefore the stack pointer
needs to be aligned to the alloca's maximum alignment requirement. This
required the following changes:
- Add FixedAllocaSizeBytes to SpillAreaSizeBytes before aligning it.
- Compute the maximum alignment requirement from FixedAllocaAlignBytes
  and SpillAreaAlignmentBytes, and prior NeedsStackAlignment uses.
- Always align the stack pointer to this maximum.
- Affected lit tests have been rebased. Note that in some cases the
  frame size is now bigger than necessary. This is due to
  FixedAllocaSizeBytes being padding to be a multiple of the alignment.
  This isn't strictly necessary since the spill areas take care of their
  own alignment.

BUG=swiftshader:29

Change-Id: Ief30acda91c958d072528b8b59c2e933f68adbb1
Reviewed-on: https://chromium-review.googlesource.com/419816
Reviewed-by: Jim Stichnoth <stichnot@chromium.org>
src/IceTargetLoweringX86Base.h
src/IceTargetLoweringX86BaseImpl.h
tests_lit/asan_tests/alignment.ll
tests_lit/llvm2ice_tests/alloc.ll
tests_lit/llvm2ice_tests/fused-alloca.ll