[PATCH] D92906: [PowerPC] Restore stack ptr from frame ptr with setjmp
Nemanja Ivanovic via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 8 19:42:54 PST 2020
nemanjai created this revision.
nemanjai added reviewers: vchuravy, hfinkel, PowerPC.
Herald added subscribers: shchenz, kbarton, hiraditya.
nemanjai requested review of this revision.
Herald added a project: LLVM.
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.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D92906
Files:
llvm/lib/Target/PowerPC/PPCFrameLowering.cpp
llvm/test/CodeGen/PowerPC/stack-restore-with-setjmp.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D92906.310409.patch
Type: text/x-patch
Size: 7878 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201209/f5fd5d2f/attachment-0001.bin>
More information about the llvm-commits
mailing list