[PATCH] D88641: [AArch64] Omit SEH directives for the epilogue if none are needed

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 1 02:07:12 PDT 2020


mstorsjo created this revision.
mstorsjo added reviewers: efriedma, rnk, ssijaric, TomTan.
Herald added subscribers: danielkiss, hiraditya, kristof.beyls.
Herald added a project: LLVM.
mstorsjo requested review of this revision.

For these cases, we already omit the prologue directives, if (!AFI->hasStackFrame() && !windowsRequiresStackProbe && !NumBytes).

When writing the epilogue (after the prolog has been written), if the function doesn't have the WinCFI flag set (i.e. if no prologue was generated), assume that no epilogue will be needed either, and don't emit any epilog start pseudo instruction. After completing the epilogue, make sure that we end up with matching epilog start/end.

Previously, when epilog start/end was generated, but no prologue, the unwind info for such functions actually was huge; 12 bytes xdata (4 bytes header, 4 bytes for one non-folded epilogue, 4 bytes for padded opcodes) and 8 bytes pdata. Because the epilog consisted of one opcode (end) but the prolog was empty (no .seh_endprologue), the epilogue couldn't be folded into the prologue, and thus couldn't be considered for packed form either.

On a 6.5 MB DLL with 110 KB pdata and 166 KB xdata, this gets rid of 38 KB pdata and 62 KB xdata.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D88641

Files:
  llvm/lib/Target/AArch64/AArch64FrameLowering.cpp
  llvm/test/CodeGen/AArch64/lrint-conv-fp16-win.ll
  llvm/test/CodeGen/AArch64/lrint-conv-win.ll
  llvm/test/CodeGen/AArch64/lround-conv-fp16-win.ll
  llvm/test/CodeGen/AArch64/lround-conv-win.ll
  llvm/test/CodeGen/AArch64/powi-windows.ll
  llvm/test/CodeGen/AArch64/win64-nocfi.ll
  llvm/test/CodeGen/AArch64/win_cst_pool.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D88641.295485.patch
Type: text/x-patch
Size: 7600 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201001/adfa4e49/attachment.bin>


More information about the llvm-commits mailing list