Page MenuHomePhabricator

[MC] [Win64EH] Write packed ARM64 epilogs if possible
ClosedPublic

Authored by mstorsjo on Sep 9 2020, 4:43 AM.

Details

Summary

This gives a pretty substantial size reduction; for a 6.5 MB DLL with 300 KB .xdata, the .xdata shrinks by 66 KB.

Diff Detail

Event Timeline

mstorsjo created this revision.Sep 9 2020, 4:43 AM
efriedma added inline comments.Sep 9 2020, 1:55 PM
llvm/include/llvm/MC/MCWinEH.h
32

Intentionally not comparing the label? That seems sort of confusing

llvm/lib/MC/MCWin64EH.cpp
642

Maybe early-return -1 here?

mstorsjo added inline comments.Sep 9 2020, 11:05 PM
llvm/include/llvm/MC/MCWinEH.h
32

Yeah, intentionally, as it's used for checking whether an opcode in the epilogue is equivalent to one in the prologue.

AFAIK the labels aren't really used for ARM64 opcodes, where the sequence is supposed to match 1-to-1 between opcodes and instructions - contrary to on x86_64, where each opcode contains the offset from the start to the particular instruction. And even if the labels would be set (I haven't checked if they are for ARM64), you'd have them pointing at different locations in prologue and epilogue.

I can add a comment to clarify.

llvm/lib/MC/MCWin64EH.cpp
642

Sure

mstorsjo updated this revision to Diff 290877.Sep 9 2020, 11:23 PM

Added a comment in the operator== about why the label isn't included in the comparison, changed the last condition into an early return like the other ones.

This revision is now accepted and ready to land.Sep 10 2020, 6:12 PM
This revision was automatically updated to reflect the committed changes.