[all-commits] [llvm/llvm-project] 8f623f: [AArch64][SVE] Restore SP from FP when SVE CSRs an...

Bradley Smith via All-commits all-commits at lists.llvm.org
Wed May 4 05:57:45 PDT 2022

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8f623f4ab0ceb390698bfacdbb01d6be30005c7e
  Author: Bradley Smith <bradley.smith at arm.com>
  Date:   2022-05-04 (Wed, 04 May 2022)

  Changed paths:
    M llvm/lib/Target/AArch64/AArch64FrameLowering.cpp
    M llvm/test/CodeGen/AArch64/framelayout-sve.mir
    M llvm/test/CodeGen/AArch64/sve-alloca.ll

  Log Message:
  [AArch64][SVE] Restore SP from FP when SVE CSRs and variable sized objects are present

Without SVE, after a dynamic stack allocation has modified the SP, it is
presumed that a frame pointer restoration will revert the SP back to
it's correct value prior to any caller stack being restored. However the
SVE frame is restored using the stack pointer directly, as it is located
after the frame pointer. This means that in the presence of a dynamic
stack allocation, any SVE callee state gets corrupted as SP has the
incorrect value when the SVE state is restored.

To address this issue, when variable sized objects and SVE CSRs are
present, treat the stack as having been realigned, hence restoring the
stack pointer from the frame pointerr prior to restoring the SVE state.

Differential Revision: https://reviews.llvm.org/D124615

More information about the All-commits mailing list