[llvm] [X86][WinEH] Restore parent RSP before Win64 catchret continuation (PR #191616)

Eli Friedman via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 11 11:46:09 PDT 2026


https://github.com/efriedma-quic commented:

The way you're trying to do this can't work in general: we don't track how much dynamically allocated memory is currently allocated on the stack, so there's no way to "restore" SP without clobbering allocated memory.

The way MSVC handles this is that it simply doesn't do any adjustments before and after calls.  Instead, whenever the code dynamically allocates memory, it reserves a region of memory below the dynamic allocation to store call arguments.  So there's always enough space to store call arguments without adjustments, and no "restore" is necessary after a catch.

https://github.com/llvm/llvm-project/pull/191616


More information about the llvm-commits mailing list