aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Option/OptTable.cpp
diff options
context:
space:
mode:
authormconst <mconst@gmail.com>2025-01-22 23:07:07 -0800
committerGitHub <noreply@github.com>2025-01-23 12:37:07 +0530
commit3fb8c5b43195d6e11ff0557d07e75700343d369f (patch)
treef603afa1730cb722d770f1e0c2934015c989766f /llvm/lib/Option/OptTable.cpp
parent220004d2f8692e3a224dc75f7a7c6001711d3d58 (diff)
downloadllvm-3fb8c5b43195d6e11ff0557d07e75700343d369f.zip
llvm-3fb8c5b43195d6e11ff0557d07e75700343d369f.tar.gz
llvm-3fb8c5b43195d6e11ff0557d07e75700343d369f.tar.bz2
[X86] Fix invalid instructions on x32 with large stack frames (#124041)
`X86FrameLowering::emitSPUpdate()` assumes that 64-bit targets use a 64-bit stack pointer, but that's not true on x32. When checking the stack pointer size, we need to look at `Uses64BitFramePtr` rather than `Is64Bit`. This avoids generating invalid instructions like `add esp, rcx`. For impossibly-large stack frames (4 GiB or larger with a 32-bit stack pointer), we were also generating invalid instructions like `mov eax, 5000000000`. The inline stack probe code already had a check for that situation; I've moved the check into `emitSPUpdate()`, so any attempt to allocate a 4 GiB stack frame with a 32-bit stack pointer will now trap rather than adjusting ESP by the wrong amount. This also fixes the "can't have 32-bit 16GB stack frame" assertion, which used to be triggerable by user code but is now correct. To help catch situations like this in the future, I've added `-verify-machineinstrs` to the stack clash tests that generate large stack frames. This fixes the expensive-checks buildbot failure caused by #113219.
Diffstat (limited to 'llvm/lib/Option/OptTable.cpp')
0 files changed, 0 insertions, 0 deletions