[all-commits] [llvm/llvm-project] ba1202: [PowerPC] Restore stack ptr from base ptr when ava...

Nemanja Ivanovic via All-commits all-commits at lists.llvm.org
Tue Dec 22 03:44:32 PST 2020


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ba1202a1e4f75d8f234d01730ac65a913e9baa01
      https://github.com/llvm/llvm-project/commit/ba1202a1e4f75d8f234d01730ac65a913e9baa01
  Author: Nemanja Ivanovic <nemanja.i.ibm at gmail.com>
  Date:   2020-12-22 (Tue, 22 Dec 2020)

  Changed paths:
    M compiler-rt/test/asan/TestCases/Posix/unpoison-alternate-stack.cpp
    M compiler-rt/test/asan/TestCases/longjmp.cpp
    M llvm/lib/Target/PowerPC/PPCFrameLowering.cpp
    M llvm/test/CodeGen/PowerPC/aix-base-pointer.ll
    M llvm/test/CodeGen/PowerPC/pr46759.ll
    M llvm/test/CodeGen/PowerPC/stack-clash-prologue.ll
    M llvm/test/CodeGen/PowerPC/stack-realign.ll

  Log Message:
  -----------
  [PowerPC] Restore stack ptr from base ptr when available

On subtargets that have a red zone, we will copy the stack pointer to the base
pointer in the prologue prior to updating the stack pointer. There are no other
updates to the base pointer after that. This suggests that we should be able to
restore the stack pointer from the base pointer rather than loading it from the
back chain or adding the frame size back to either the stack pointer or the
frame pointer.
This came about because functions that call setjmp need to restore the SP from
the FP because the back chain might have been clobbered
(see https://reviews.llvm.org/D92906). However, if the stack is realigned, the
restored SP might be incorrect (which is what caused the failures in the two
ASan test cases).

This patch was tested quite extensivelly both with sanitizer runtimes and
general code.

Differential revision: https://reviews.llvm.org/D93327




More information about the All-commits mailing list