[PATCH] [RewriteStatepointsForGC] Fix a bug on creating gc_relocate for pointer to vector of pointers

Chen Li meloli87 at gmail.com
Thu May 7 17:48:15 PDT 2015


Hi sanjoy, reames, AndyAyers,

In RewriteStatepointsForGC pass, we create a gc_relocate intrinsic for each relocated pointer, and the gc_relocate has the same type with the pointer. During the creation of gc_relocate intrinsic, llvm requires to mangle its type. However, llvm does not support mangling of all possible types. RewriteStatepointsForGC will hit an assertion failure when it tries to create a gc_relocate for pointer to vector of pointers because mangling for vector of pointers is not supported. 

To remove the dependency of type mangling, this patch changes the way RewriteStatepointsForGC pass creates gc_relocate. For each relocated pointer, we create a gc_relocate of type i8 addrspace(1)* no matter what type of the relocated pointer. Then a bitcast is inserted to convert the gc_relocate to the correct type. In this way, gc_relocate can support all possible pointer types, and does not need to worry about future changes of supported type mangling. 

Some minor changes are also introduced to gc_relocate related part in InstCombineCalls, CodeGenPrepare, and Verifier accordingly.

http://reviews.llvm.org/D9592

Files:
  lib/CodeGen/CodeGenPrepare.cpp
  lib/IR/Verifier.cpp
  lib/Transforms/InstCombine/InstCombineCalls.cpp
  lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
  test/Transforms/RewriteStatepointsForGC/base-pointers-11.ll
  test/Transforms/RewriteStatepointsForGC/base-pointers.ll
  test/Transforms/RewriteStatepointsForGC/gc_relocate_creation.ll
  test/Transforms/RewriteStatepointsForGC/live-vector.ll
  test/Transforms/RewriteStatepointsForGC/liveness-basics.ll
  test/Transforms/RewriteStatepointsForGC/preprocess.ll
  test/Transforms/RewriteStatepointsForGC/relocate_invoke_result.ll
  test/Transforms/RewriteStatepointsForGC/relocation.ll

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D9592.25267.patch
Type: text/x-patch
Size: 21681 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150508/e83a27c8/attachment.bin>


More information about the llvm-commits mailing list