[PATCH] D73126: [X86] Generate unaligned access for fixed slots in unaligned stack

Jann Horn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 21 10:29:51 PST 2020


thejh created this revision.
thejh added reviewers: craig.topper, asl, arsenm, thegameg, delena.
thejh added a project: LLVM.
Herald added subscribers: llvm-commits, hiraditya, wdng, qcolombet.

loadRegFromStackSlot()/storeRegToStackSlot() can generate aligned access
instructions for stack slots even if the stack is unaligned, based on the
assumption that the stack can be realigned.
However, this doesn't work for fixed slots, which are e.g. used for
spilling XMM registers in a non-leaf function with
`__attribute__((preserve_all))`.
When compiling such code with `-mstack-alignment=8`, this causes general
protection faults.

Fix it by only considering stack realignment for non-fixed slots.

Note that this changes the output of three existing tests which spill AVX
registers, since AVX requires higher alignment than the ABI provides on
stack frame entry.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D73126

Files:
  llvm/lib/Target/X86/X86InstrInfo.cpp
  llvm/test/CodeGen/X86/anyregcc.ll
  llvm/test/CodeGen/X86/avx-intel-ocl.ll
  llvm/test/CodeGen/X86/avx512-intel-ocl.ll
  llvm/test/CodeGen/X86/x86-64-xmm-spill-unaligned.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D73126.239367.patch
Type: text/x-patch
Size: 19435 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200121/1824bc6a/attachment.bin>


More information about the llvm-commits mailing list