[PATCH] D73752: [SEH] Remove CATCHPAD SDNode and X86::EH_RESTORE MachineInstr

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 30 15:35:48 PST 2020


rnk created this revision.
rnk added a reviewer: hans.
Herald added subscribers: aheejin, hiraditya.
Herald added a project: LLVM.

The CATCHPAD node mostly existed to be selected into the EH_RESTORE
instruction, which sets the frame back up when 32-bit Windows exceptions
return to the parent function. However, creating this MachineInstr early
increases the risk that other passes will come along and insert
instructions that use the stack before ESP and EBP are restored. That
happened in PR44697.

Instead of representing these in the instruction stream early, delay it
until PEI. Mark the blocks where this needs to happen as EHPads, but not
funclet entry blocks. Passes after PEI have to be careful not to hoist
instructions that can use stack across frame setup instructions, so this
should be relatively reliable.

Fixes PR44697


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D73752

Files:
  llvm/include/llvm/CodeGen/ISDOpcodes.h
  llvm/include/llvm/Target/TargetSelectionDAG.td
  llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
  llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
  llvm/lib/Target/AArch64/AArch64ISelLowering.h
  llvm/lib/Target/AArch64/AArch64InstrInfo.td
  llvm/lib/Target/X86/X86ExpandPseudo.cpp
  llvm/lib/Target/X86/X86FrameLowering.cpp
  llvm/lib/Target/X86/X86FrameLowering.h
  llvm/lib/Target/X86/X86ISelLowering.cpp
  llvm/lib/Target/X86/X86ISelLowering.h
  llvm/lib/Target/X86/X86InstrCompiler.td
  llvm/test/CodeGen/X86/seh-except-restore.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D73752.241605.patch
Type: text/x-patch
Size: 13969 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200130/32a67061/attachment.bin>


More information about the llvm-commits mailing list