[PATCH] D103732: [RS4GC] Check that GC pointers are non-integral

Sam Dirkswager via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 4 19:28:52 PDT 2021


tolziplohu created this revision.
tolziplohu added a reviewer: reames.
Herald added subscribers: jdoerfert, jfb, hiraditya, arichardson.
tolziplohu requested review of this revision.
Herald added a project: LLVM.

As discussed in D103492 <https://reviews.llvm.org/D103492>, input to the RewriteStatepointsForGC pass is only valid if the address space used for GC pointers is specified as non-integral.
This patch makes the RS4GC pass actually check this, and produce a fatal error if it isn't the case.

Exactly one of the existing tests for RS4GC actually marked address space 1 as non-integral, so I updated the rest of them to do that.
That actually means that previously, optimization passes could perform invalid optimizations on the test cases had they been run, so it could have been a latent soundness issue.
There's actually one test, `constants.ll`, which makes use of a bunch of `inttoptr` instructions; this shouldn't have been allowed in the first place, as discussed in D103492 <https://reviews.llvm.org/D103492>, so it's currently expected to fail.
I'm not sure what it was actually meant to test, so it could be rewritten to test it another way.

This patch hardcodes address space 1 as marking GC pointers.
Theoretically it should be configurable, but it was already hardcoded in other places so another patch is still needed to support that.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D103732

Files:
  llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
  llvm/test/Transforms/RewriteStatepointsForGC/X86/intrinsic-attributes.ll
  llvm/test/Transforms/RewriteStatepointsForGC/base-inference.ll
  llvm/test/Transforms/RewriteStatepointsForGC/base-pointers-1.ll
  llvm/test/Transforms/RewriteStatepointsForGC/base-pointers-10.ll
  llvm/test/Transforms/RewriteStatepointsForGC/base-pointers-11.ll
  llvm/test/Transforms/RewriteStatepointsForGC/base-pointers-12.ll
  llvm/test/Transforms/RewriteStatepointsForGC/base-pointers-13.ll
  llvm/test/Transforms/RewriteStatepointsForGC/base-pointers-2.ll
  llvm/test/Transforms/RewriteStatepointsForGC/base-pointers-3.ll
  llvm/test/Transforms/RewriteStatepointsForGC/base-pointers-4.ll
  llvm/test/Transforms/RewriteStatepointsForGC/base-pointers-5.ll
  llvm/test/Transforms/RewriteStatepointsForGC/base-pointers-6.ll
  llvm/test/Transforms/RewriteStatepointsForGC/base-pointers-7.ll
  llvm/test/Transforms/RewriteStatepointsForGC/base-pointers-8.ll
  llvm/test/Transforms/RewriteStatepointsForGC/base-pointers-9.ll
  llvm/test/Transforms/RewriteStatepointsForGC/base-pointers.ll
  llvm/test/Transforms/RewriteStatepointsForGC/base-vector-inseltpoison.ll
  llvm/test/Transforms/RewriteStatepointsForGC/base-vector.ll
  llvm/test/Transforms/RewriteStatepointsForGC/basic.ll
  llvm/test/Transforms/RewriteStatepointsForGC/basics.ll
  llvm/test/Transforms/RewriteStatepointsForGC/call-gc-result.ll
  llvm/test/Transforms/RewriteStatepointsForGC/codegen-cond.ll
  llvm/test/Transforms/RewriteStatepointsForGC/constants.ll
  llvm/test/Transforms/RewriteStatepointsForGC/deopt-intrinsic-cconv.ll
  llvm/test/Transforms/RewriteStatepointsForGC/deopt-intrinsic.ll
  llvm/test/Transforms/RewriteStatepointsForGC/deopt-lowering-attrs.ll
  llvm/test/Transforms/RewriteStatepointsForGC/deref-pointers.ll
  llvm/test/Transforms/RewriteStatepointsForGC/drop-invalid-metadata.ll
  llvm/test/Transforms/RewriteStatepointsForGC/gc-relocate-creation.ll
  llvm/test/Transforms/RewriteStatepointsForGC/intrinsics.ll
  llvm/test/Transforms/RewriteStatepointsForGC/invokes.ll
  llvm/test/Transforms/RewriteStatepointsForGC/leaf-function.ll
  llvm/test/Transforms/RewriteStatepointsForGC/libcall.ll
  llvm/test/Transforms/RewriteStatepointsForGC/live-vector-nosplit-inseltpoison.ll
  llvm/test/Transforms/RewriteStatepointsForGC/live-vector-nosplit.ll
  llvm/test/Transforms/RewriteStatepointsForGC/liveness-basics.ll
  llvm/test/Transforms/RewriteStatepointsForGC/meetBDVState-hangs.ll
  llvm/test/Transforms/RewriteStatepointsForGC/patchable-statepoints.ll
  llvm/test/Transforms/RewriteStatepointsForGC/preprocess.ll
  llvm/test/Transforms/RewriteStatepointsForGC/relocate-invoke-result.ll
  llvm/test/Transforms/RewriteStatepointsForGC/relocation.ll
  llvm/test/Transforms/RewriteStatepointsForGC/rematerialize-derived-pointers.ll
  llvm/test/Transforms/RewriteStatepointsForGC/rewrite-invoke.ll
  llvm/test/Transforms/RewriteStatepointsForGC/scalar-base-vector-2.ll
  llvm/test/Transforms/RewriteStatepointsForGC/scalar-base-vector.ll
  llvm/test/Transforms/RewriteStatepointsForGC/statepoint-attrs.ll
  llvm/test/Transforms/RewriteStatepointsForGC/statepoint-calling-conventions.ll
  llvm/test/Transforms/RewriteStatepointsForGC/statepoint-coreclr.ll
  llvm/test/Transforms/RewriteStatepointsForGC/statepoint-format.ll
  llvm/test/Transforms/RewriteStatepointsForGC/strip-invalid-attributes.ll
  llvm/test/Transforms/RewriteStatepointsForGC/two-invokes-one-landingpad.ll
  llvm/test/Transforms/RewriteStatepointsForGC/unordered-atomic-memcpy-no-deopt.ll
  llvm/test/Transforms/RewriteStatepointsForGC/unordered-atomic-memcpy.ll
  llvm/test/Transforms/RewriteStatepointsForGC/unreachable-regression.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D103732.350007.patch
Type: text/x-patch
Size: 64900 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210605/f56fa22b/attachment.bin>


More information about the llvm-commits mailing list