diff options
author | Daniel Paoliello <danpao@microsoft.com> | 2025-08-15 09:03:44 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-08-15 09:03:44 -0700 |
commit | 1d1e52e614f95eed5ee440b43fa1992e46976629 (patch) | |
tree | aab6b97ad683d0db379036798a5311e27f679af1 /llvm/lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp | |
parent | 08ff017fb0c9c7c3c91858023ea45149449fbbfc (diff) | |
download | llvm-1d1e52e614f95eed5ee440b43fa1992e46976629.zip llvm-1d1e52e614f95eed5ee440b43fa1992e46976629.tar.gz llvm-1d1e52e614f95eed5ee440b43fa1992e46976629.tar.bz2 |
[win][x64] Allow push/pop for stack alloc when unwind v2 is required (#153621)
While attempting to enable Windows x64 unwind v2, compilation failed
with the following error:
```
fatal error: error in backend: Windows x64 Unwind v2 is required, but LLVM has generated incompatible code in function '<redacted>': Cannot pop registers before the stack allocation has been deallocated
```
I traced this down to an optimization in `X86FrameLowering`:
<https://github.com/llvm/llvm-project/blob/6961139ce9154d03c88b8d46c8742a1eaa569cd9/llvm/lib/Target/X86/X86FrameLowering.cpp#L324-L340>
Technically, using `push`/`pop` to adjust the stack is permitted under
unwind v2: the requirement for a "canonical" epilog is that the stack is
fully adjusted before the registers listed as pushed in the unwind table
are popped. So, as long as the `.seh_unwindv2start` pseudo is after the
pops that adjust the stack, then everything will work correctly.
One other side effect of this change is that the stack is now allowed to
be adjusted across multiple instructions, which would be needed for
extremely large stack frames.
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp')
0 files changed, 0 insertions, 0 deletions