diff options
author | Sanjoy Das <sanjoy@playingwithpointers.com> | 2015-05-11 18:49:34 +0000 |
---|---|---|
committer | Sanjoy Das <sanjoy@playingwithpointers.com> | 2015-05-11 18:49:34 +0000 |
commit | 89c5491a72d2eda952f8314e6700e8657e13ffb6 (patch) | |
tree | 1ce36270d68aca3464a611392fb1247731002b0b /llvm/test/Transforms/RewriteStatepointsForGC/preprocess.ll | |
parent | 539175428883f84c4c8c8e6cc051a5d5b02fde88 (diff) | |
download | bcm5719-llvm-89c5491a72d2eda952f8314e6700e8657e13ffb6.tar.gz bcm5719-llvm-89c5491a72d2eda952f8314e6700e8657e13ffb6.zip |
[RewriteStatepointsForGC] Fix a bug on creating gc_relocate for pointer to vector of pointers
Summary:
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.
This patch changes the way RewriteStatepointsForGC pass creates
gc_relocate. For each relocated pointer, we erase the type of pointers
and create an unified gc_relocate of type i8 addrspace(1)*. Then a
bitcast is inserted to convert the gc_relocate to the correct type. In
this way, gc_relocate does not need to deal with different types of
pointers and the unsupported type mangling is no longer a problem. This
change would also ease further merge when LLVM erases types of pointers
and introduces an unified pointer type.
Some minor changes are also introduced to gc_relocate related part in
InstCombineCalls, CodeGenPrepare, and Verifier accordingly.
Patch by Chen Li!
Reviewers: reames, AndyAyers, sanjoy
Reviewed By: sanjoy
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D9592
llvm-svn: 237009
Diffstat (limited to 'llvm/test/Transforms/RewriteStatepointsForGC/preprocess.ll')
-rw-r--r-- | llvm/test/Transforms/RewriteStatepointsForGC/preprocess.ll | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/test/Transforms/RewriteStatepointsForGC/preprocess.ll b/llvm/test/Transforms/RewriteStatepointsForGC/preprocess.ll index ffdfe5be350..39567b12227 100644 --- a/llvm/test/Transforms/RewriteStatepointsForGC/preprocess.ll +++ b/llvm/test/Transforms/RewriteStatepointsForGC/preprocess.ll @@ -13,8 +13,9 @@ next: ; CHECK-LABEL: next: ; CHECK-NEXT: gc.statepoint ; CHECK-NEXT: gc.relocate -; CHECK-NEXT: @consume(i64 addrspace(1)* %obj.relocated) -; CHECK-NEXT: @consume(i64 addrspace(1)* %obj.relocated) +; CHECK-NEXT: bitcast +; CHECK-NEXT: @consume(i64 addrspace(1)* %obj.relocated.casted) +; CHECK-NEXT: @consume(i64 addrspace(1)* %obj.relocated.casted) %obj2 = phi i64 addrspace(1)* [ %obj, %entry ] call i32 (void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(void ()* @foo, i32 0, i32 0, i32 0, i32 0) call void (...) @consume(i64 addrspace(1)* %obj2) |