[PATCH] D124444: Only export STATEPOINT results if used in nonlocal blocks.

Denis Antrushin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 26 04:04:19 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.

Cuurently we always export STATEPOINT results (GC pointers lowered via VRegs)
to virtual registers. When processing gc.relocate instructions we have to
generate CopyFromRegs node and then export it to VReg again if gc.relocate
is used in other basic blocks. This results in generation of extra COPY MIR
instruction if statepoint and its gc.relocate are in same BB, but gc.relocate
result is used in other blocks.

This patch changes this behavior to export statepoint results only if used
in other basic blocks. It also records gc.relocate SDValue mapping for local
uses (it is equal to corresponding STATEPOINT result). Doing this gc.relocate
mapping in `LowerStatepoint()` allows to avoid complicated data structures which
need to be maintained across BB boundaries.

This is NFC and is purely compile time optimization. On big methids it can improve
codegen compile time up to 10%.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D124444

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D124444.425174.patch
Type: text/x-patch
Size: 17101 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220426/5b6e0292/attachment.bin>


More information about the llvm-commits mailing list