[all-commits] [llvm/llvm-project] 4d26f4: [RS4GC] Introduce intrinsics to get base ptr and o...

Yevgeny Rouban via All-commits all-commits at lists.llvm.org
Wed May 26 19:15:58 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 4d26f41f76c4f92023c02ec96ffbd02a6eb2c46d
      https://github.com/llvm/llvm-project/commit/4d26f41f76c4f92023c02ec96ffbd02a6eb2c46d
  Author: Yevgeny Rouban <yrouban at azul.com>
  Date:   2021-05-27 (Thu, 27 May 2021)

  Changed paths:
    M llvm/docs/LangRef.rst
    M llvm/docs/Statepoints.rst
    M llvm/include/llvm/IR/IRBuilder.h
    M llvm/include/llvm/IR/Intrinsics.td
    M llvm/lib/IR/IRBuilder.cpp
    M llvm/lib/IR/Verifier.cpp
    M llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
    A llvm/test/Transforms/RewriteStatepointsForGC/intrinsics.ll

  Log Message:
  -----------
  [RS4GC] Introduce intrinsics to get base ptr and offset

There can be a need for some optimizations to get (base, offset)
for any GC pointer. The base can be calculated by generating
needed instructions as it is done by the
RewriteStatepointsForGC::findBasePointer() function. The offset
can be calculated in the same way. Though to not expose the base
calculation and to make the offset calculation as simple as
ptrtoint(derived_ptr) - ptrtoint(base_ptr), which is illegal
outside RS4GC, this patch introduces 2 intrinsics:

 @llvm.experimental.gc.get.pointer.base(%derived_ptr)
 @llvm.experimental.gc.get.pointer.offset(%derived_ptr)

These intrinsics are inlined by RS4GC along with generation of
statepoint sequences.

With these new intrinsics the GC parseable lowering for atomic
memcpy intrinsics (6ec2c5e402a724ba99bce82a9cac7a3006d660f4)
could be implemented as a separate pass.

Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D100445




More information about the All-commits mailing list