[PATCH] D122541: [X86] Set frame-setup/frame-destroy on prologue/epilogue CFI instructions

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Mar 27 00:38:21 PDT 2022


MaskRay created this revision.
MaskRay added reviewers: craig.topper, LuoYuanke, pengfei, RKSimon.
Herald added subscribers: StephenFan, hiraditya, kristof.beyls.
Herald added a project: All.
MaskRay requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This approach is used by AArch64 to make frame-setup/frame-destroy instructions
contiguous instead of leaved by CFI instructions. Code checking
`MBBI->getFlag(MachineInstr::FrameSetup) || MBBI->isCFIInstruction()` can be
simplified to just check FrameSetup.

This helps get all CFI instructions in the prologue, which can be handy to use
.cfi_remember_state/.cfi_restore_state to decrease unwind table size.

Currently there is no `CFI_INSTRUCTION` MIR test with .ll input. This patch
adds some -stop-after=prologepilog tests.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D122541

Files:
  llvm/lib/Target/X86/X86FrameLowering.cpp
  llvm/lib/Target/X86/X86FrameLowering.h
  llvm/test/CodeGen/X86/cfi-xmm.ll
  llvm/test/CodeGen/X86/epilogue-cfi-fp.ll
  llvm/test/CodeGen/X86/push-cfi.ll
  llvm/test/CodeGen/X86/throws-cfi-fp.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D122541.418440.patch
Type: text/x-patch
Size: 9822 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220327/f3b8eba8/attachment.bin>


More information about the llvm-commits mailing list