summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR
diff options
context:
space:
mode:
authorSanjoy Das <sanjoy@playingwithpointers.com>2015-05-11 18:49:34 +0000
committerSanjoy Das <sanjoy@playingwithpointers.com>2015-05-11 18:49:34 +0000
commit89c5491a72d2eda952f8314e6700e8657e13ffb6 (patch)
tree1ce36270d68aca3464a611392fb1247731002b0b /llvm/lib/IR
parent539175428883f84c4c8c8e6cc051a5d5b02fde88 (diff)
downloadbcm5719-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/lib/IR')
-rw-r--r--llvm/lib/IR/Verifier.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp
index 374f8f210be..a5d5829b071 100644
--- a/llvm/lib/IR/Verifier.cpp
+++ b/llvm/lib/IR/Verifier.cpp
@@ -3384,10 +3384,8 @@ void Verifier::visitIntrinsicFunctionCall(Intrinsic::ID ID, CallInst &CI) {
"'gc parameters' section of the statepoint call",
&CI);
- // Assert that the result type matches the type of the relocated pointer
- GCRelocateOperands Operands(&CI);
- Assert(Operands.getDerivedPtr()->getType() == CI.getType(),
- "gc.relocate: relocating a pointer shouldn't change its type", &CI);
+ // gc_relocate does not need to be the same type as the relocated pointer.
+ // It can casted to the correct type later if it's desired
break;
}
};
OpenPOWER on IntegriCloud