[PATCH] D123530: Optimize cross block gc.relocate lowering. NFC.

Denis Antrushin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 11 11:35:03 PDT 2022


dantrushin created this revision.
dantrushin added reviewers: skatkov, reames.
Herald added subscribers: pengfei, hiraditya.
Herald added a project: All.
dantrushin requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

At IR level `gc.relocate` is used to express new value of GC pointer
which may have changed during call wrapped by statepoint (IR instructions
have only single def; `gc.relocate` is a workaround for this limitation).
But MachineInstruction can have multiple results (DEF registers),
so `gc.relocate` is not needed here - it is equal to the corresponding
STATEPOINT DEF operand (when GC pointers are lowered via VRegs).

This means that during lowering of `gc.relocate` which has uses outside
its basic block we can simply use virtual register exported by STATEPOINT
and not generate CopyFromRegs/CopyToRegs SDNodes which copy one virtual
register to another, producing redundant COPY instruction.

This is purely compile time optimization. On big methods it can
improve compile time up to 10%.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D123530

Files:
  llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
  llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp
  llvm/test/CodeGen/X86/statepoint-vreg-details.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D123530.421986.patch
Type: text/x-patch
Size: 4466 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220411/605e99f4/attachment.bin>


More information about the llvm-commits mailing list