[all-commits] [llvm/llvm-project] bfdc19: [PowerPC] Restore stack ptr from frame ptr with se...

Nemanja Ivanovic via All-commits all-commits at lists.llvm.org
Mon Dec 14 09:35:19 PST 2020


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

  Changed paths:
    M llvm/lib/Target/PowerPC/PPCFrameLowering.cpp
    A llvm/test/CodeGen/PowerPC/stack-restore-with-setjmp.ll

  Log Message:
  -----------
  [PowerPC] Restore stack ptr from frame ptr with setjmp

If a function happens to:

- call setjmp
- do a 16-byte stack allocation
- call a function that sets up a stack frame and longjmp's back

The stack pointer that is restores by setjmp will no longer point to a valid
back chain. According to the ABI, stack accesses in such a function are to be
frame pointer based - so it is an error (quite obviously) to restore the stack
from the back chain.
We already restore the stack from the frame pointer when there are calls to
fast_cc functions. We just need to also do that when there are calls to setjmp.
This patch simply does that.

This was pointed out by the Julia team.

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




More information about the All-commits mailing list