This is an archive of the discontinued LLVM Phabricator instance.

[AArch64] Add missing SEH_Nop when aligning the stack
ClosedPublic

Authored by mstorsjo on Oct 3 2022, 1:42 PM.

Details

Summary

This makes sure that the instructions of the prologue matches the
SEH opcodes.

Also remove a couple redundant cases of setting HasWinCFI; it was
already set unconditionally after the conditional cases.

Diff Detail

Event Timeline

mstorsjo created this revision.Oct 3 2022, 1:42 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 3 2022, 1:42 PM
mstorsjo requested review of this revision.Oct 3 2022, 1:42 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 3 2022, 1:42 PM
efriedma added inline comments.Oct 3 2022, 3:35 PM
llvm/test/CodeGen/AArch64/wineh-align-stack.ll
24

The prologue should end after the set_set_fp; it makes no sense to try to represent the "and" in the SEH unwind tables. (I thought we discussed this before at some point, but maybe I'm confusing it with something else...)

mstorsjo added inline comments.Oct 3 2022, 10:53 PM
llvm/test/CodeGen/AArch64/wineh-align-stack.ll
24

Yes, we discussed that for the ARM implementation of SEH, and I changed it that way there in the end.

For AArch64, the SEH prologue currently includes all of the realigning; I agree that it would be more correct to omit that from the prologue entirely. The AArch64 SEH insertion is a bit more annoying to fix though, as it currently adds all these individual SEH opcodes along with the prologue instructions, while the ARM implementation adds SEH opcodes for all instructions in a range in an MBB later, making it easier to include or leave out parts of it.

So for this case, I mostly wanted to fix mismatches to make D131394 work - I'd prefer to leave out this (trimming out unnecessary parts of the prologue in these cases) as a task up for grabs for someone else.

efriedma accepted this revision.Oct 4 2022, 11:39 AM

LGTM

llvm/test/CodeGen/AArch64/wineh-align-stack.ll
24

Please leave a FIXME in the testcase, for whoever is updating it in the future.

This revision is now accepted and ready to land.Oct 4 2022, 11:39 AM
This revision was landed with ongoing or failed builds.Oct 5 2022, 1:00 AM
This revision was automatically updated to reflect the committed changes.