[PATCH] D141110: [RS4GC] Remove the hardcoded GC strategy names (v2)

Campbell Suter via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 5 23:07:55 PST 2023


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

Previously, RewriteStatepointsForGC had a hardcoded list of GC
strategies for which it would run, and using it with a custom strategy
required patching LLVM.

The locic for selecting the variables that are considered managed was
also hardcoded to use pointers in address space 1, rather than
delegating to GCStrategy::isGCManagedPointer.

This patch fixes both of these flaws: this pass now applies to all
functions whose GCStrategy returns true for useStatepoints, and checking
if a pointer is managed or not is also now done by the strategy.

One potentially questionable design decision in this change: the pass will
be enabled for all GC strategies that use statepoints. It seems unlikely
this would be a problem - consumers that don't use this pass probably
aren't adding it to the pass manager anyway - but if you had two different
GC strategies and only one wants this pass enabled then that'd need a new
flag in GCStrategy, which I can add if anyone thinks it's necessary.

This is an updated version of D140458 <https://reviews.llvm.org/D140458>, rebased to account for LLVM's
changes since D140458 <https://reviews.llvm.org/D140458> (required by this patch) landed.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D141110

Files:
  llvm/docs/Statepoints.rst
  llvm/include/llvm/Transforms/Scalar/RewriteStatepointsForGC.h
  llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D141110.486753.patch
Type: text/x-patch
Size: 25718 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230106/fd0e54e9/attachment-0001.bin>


More information about the llvm-commits mailing list