[PATCH] D135687: [AArch64] Fix aligning the stack after calling __chkstk

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 11 15:40:33 PDT 2022


efriedma added a comment.

After staring at my code sequence a bit more, it simplifies to:

  mov x15, #(NumBytes/16)
  mov x9, sp
  ubfx x9, x9, #4, #AlignBits
  add x15, x15, x9
  bl __chkstk
  sub sp, sp, x15, lsl #4

Your suggested sequence also works, I guess, but it feels a little weird to overallocate, then deallocate the extra memory.

MSVC doesn't actually realign the stack in the sense LLVM does; it just overallocates stack memory, then uses masking to align the addresses of variables.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D135687/new/

https://reviews.llvm.org/D135687



More information about the llvm-commits mailing list