diff options
author | Talin <viridia@gmail.com> | 2010-09-30 20:23:47 +0000 |
---|---|---|
committer | Talin <viridia@gmail.com> | 2010-09-30 20:23:47 +0000 |
commit | c87cfb6a8134edecbeded47d64e2706ba9b97b0b (patch) | |
tree | c89421c4495e27445cbd0fec05247a9c509d649b /lib/VMCore | |
parent | 7eae36b38b874f417fa191fc1cfec22c100f164d (diff) | |
download | external_llvm-c87cfb6a8134edecbeded47d64e2706ba9b97b0b.zip external_llvm-c87cfb6a8134edecbeded47d64e2706ba9b97b0b.tar.gz external_llvm-c87cfb6a8134edecbeded47d64e2706ba9b97b0b.tar.bz2 |
Allow llvm.gcroot to work with non-pointer allocas.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115198 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore')
-rw-r--r-- | lib/VMCore/Verifier.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/VMCore/Verifier.cpp b/lib/VMCore/Verifier.cpp index 7216891..384acb7 100644 --- a/lib/VMCore/Verifier.cpp +++ b/lib/VMCore/Verifier.cpp @@ -1645,10 +1645,14 @@ void Verifier::visitIntrinsicFunctionCall(Intrinsic::ID ID, CallInst &CI) { if (ID == Intrinsic::gcroot) { AllocaInst *AI = dyn_cast<AllocaInst>(CI.getArgOperand(0)->stripPointerCasts()); - Assert1(AI && AI->getType()->getElementType()->isPointerTy(), - "llvm.gcroot parameter #1 must be a pointer alloca.", &CI); + Assert1(AI, "llvm.gcroot parameter #1 must be an alloca.", &CI); Assert1(isa<Constant>(CI.getArgOperand(1)), "llvm.gcroot parameter #2 must be a constant.", &CI); + if (!AI->getType()->getElementType()->isPointerTy()) { + Assert1(!isa<ConstantPointerNull>(CI.getArgOperand(1)), + "llvm.gcroot parameter #1 must either be a pointer alloca, " + "or argument #2 must be a non-null constant.", &CI); + } } Assert1(CI.getParent()->getParent()->hasGC(), |