aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-08-24 20:46:13 +0000
committerChris Lattner <sabre@nondot.org>2008-08-24 20:46:13 +0000
commit415b414a8f20d3f2a45fccbbdaf9f4830cc9ea58 (patch)
tree9be1e63b3d40e4b40328b513da9ef95683b67d3a
parentedfb72c6288118ab9c900a560ded89dfaa107296 (diff)
remove the type checking logic already done by tblgen, just keep the
parts tblgen doesn't do (checking for constant, alloca, enclosing function has gc marker). This passes dj! :) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55294 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/VMCore/Verifier.cpp46
1 files changed, 10 insertions, 36 deletions
diff --git a/lib/VMCore/Verifier.cpp b/lib/VMCore/Verifier.cpp
index fc458c8f2f..26d55e9ffc 100644
--- a/lib/VMCore/Verifier.cpp
+++ b/lib/VMCore/Verifier.cpp
@@ -1285,43 +1285,17 @@ void Verifier::visitIntrinsicFunctionCall(Intrinsic::ID ID, CallInst &CI) {
break;
case Intrinsic::gcroot:
case Intrinsic::gcwrite:
- case Intrinsic::gcread: {
- Type *PtrTy = PointerType::getUnqual(Type::Int8Ty),
- *PtrPtrTy = PointerType::getUnqual(PtrTy);
-
- switch (ID) {
- default:
- break;
- case Intrinsic::gcroot:
- Assert1(CI.getOperand(1)->getType() == PtrPtrTy,
- "Intrinsic parameter #1 is not i8**.", &CI);
- Assert1(CI.getOperand(2)->getType() == PtrTy,
- "Intrinsic parameter #2 is not i8*.", &CI);
- Assert1(isa<AllocaInst>(CI.getOperand(1)->stripPointerCasts()),
- "llvm.gcroot parameter #1 must be an alloca.", &CI);
- Assert1(isa<Constant>(CI.getOperand(2)),
- "llvm.gcroot parameter #2 must be a constant.", &CI);
- break;
- case Intrinsic::gcwrite:
- Assert1(CI.getOperand(1)->getType() == PtrTy,
- "Intrinsic parameter #1 is not a i8*.", &CI);
- Assert1(CI.getOperand(2)->getType() == PtrTy,
- "Intrinsic parameter #2 is not a i8*.", &CI);
- Assert1(CI.getOperand(3)->getType() == PtrPtrTy,
- "Intrinsic parameter #3 is not a i8**.", &CI);
- break;
- case Intrinsic::gcread:
- Assert1(CI.getOperand(1)->getType() == PtrTy,
- "Intrinsic parameter #1 is not a i8*.", &CI);
- Assert1(CI.getOperand(2)->getType() == PtrPtrTy,
- "Intrinsic parameter #2 is not a i8**.", &CI);
- break;
- }
+ case Intrinsic::gcread:
+ if (ID == Intrinsic::gcroot) {
+ Assert1(isa<AllocaInst>(CI.getOperand(1)->stripPointerCasts()),
+ "llvm.gcroot parameter #1 must be an alloca.", &CI);
+ Assert1(isa<Constant>(CI.getOperand(2)),
+ "llvm.gcroot parameter #2 must be a constant.", &CI);
+ }
- Assert1(CI.getParent()->getParent()->hasGC(),
- "Enclosing function does not use GC.",
- &CI);
- } break;
+ Assert1(CI.getParent()->getParent()->hasGC(),
+ "Enclosing function does not use GC.", &CI);
+ break;
case Intrinsic::init_trampoline:
Assert1(isa<Function>(CI.getOperand(2)->stripPointerCasts()),
"llvm.init_trampoline parameter #2 must resolve to a function.",