[PATCH] D75288: [ARM][ConstantIslands] Fix stack mis-alignment caused by undoLRSpillRestore.

Huihui Zhang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 27 12:23:29 PST 2020


huihuiz created this revision.
huihuiz added reviewers: olista01, t.p.northover, rengolin, efriedma, apazos.
huihuiz added a project: LLVM.
Herald added subscribers: hiraditya, kristof.beyls.
huihuiz added a comment.
huihuiz added a reviewer: samparker.

run: llc -O0 < llvm/test/CodeGen/Thumb/stack-mis-alignment.ll -o -

you can see the mis-alignment, the StackAlignment is 8 for this test

  @ %bb.0:                                @ %entry
          .pad    #116
          sub     sp, #116


It is not safe for ARMConstantIsland to undoLRSpillRestore. PrologEpilogInserter is
the one to ensure stack alignment, taking into consideration LR is spilled or not.

For noreturn function with StackAlignment 8 (function contains call/alloc),
undoLRSpillRestore cause stack be mis-aligned. Fixing stack alignment in
ARMConstantIsland doesn't give us much benefit, as undo LR spill/restore only
occur in large function with near branches only, also doesn't have callee-saved LR spill.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D75288

Files:
  llvm/lib/Target/ARM/ARMConstantIslandPass.cpp
  llvm/test/CodeGen/Thumb/remove-unneeded-push-pop.ll
  llvm/test/CodeGen/Thumb/stack-mis-alignment.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D75288.247060.patch
Type: text/x-patch
Size: 6160 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200227/69184aa8/attachment.bin>


More information about the llvm-commits mailing list