[MC] [Win64EH] Don't produce packed ARM64 unwind info with homed parameters
authorMartin Storsjö <martin@martin.st>
Wed, 18 May 2022 09:36:59 +0000 (12:36 +0300)
committerMartin Storsjö <martin@martin.st>
Wed, 18 May 2022 17:34:59 +0000 (20:34 +0300)
commit924defada9bc0e3c89b0c0e288d7cb4dd654e7d4
tree9c4bb724ed9c5c892382c735239de73c49acd8f6
parent091a55c16ad4e87aa67a3c003fade1a226698734
[MC] [Win64EH] Don't produce packed ARM64 unwind info with homed parameters

There's an inconsistency regarding the epilogs of packed ARM64
unwind info with homed parameters; according to the documentation
(and according to common sense), the epilog wouldn't have a series
of nop instructions matching the stp x0-x7 in the prolog - however
in practice, RtlVirtualUnwind still seems to behave as if the epilog
does have the mirrored nops from the prolog.

In practice, MSVC doesn't seem to produce packed unwind info with
homed parameters, which might be why this inconsistency hasn't
been noticed.

Thus, to play it safe, avoid creating such packed unwind info with
homed parameters. (LLVM's current behaviour matches the current
runtime behaviour of RtlVirtualUnwind, but if it later is bug fixed
to match the documentation, such unwind information would be
incorrect.)

See https://github.com/llvm/llvm-project/issues/54879 for further
discussion on the matter.

Differential Revision: https://reviews.llvm.org/D125876
llvm/lib/MC/MCWin64EH.cpp
llvm/test/MC/AArch64/seh-packed-unwind.s