Duncan pointed out that the Extended case in getTypeForMVT could
[oota-llvm.git] / lib / VMCore / Verifier.cpp
index 820bf33bc932173860980864b5c22dc02f6b49da..f8dd24c3af62f0f7eea74b92fc96742eff954ed5 100644 (file)
@@ -418,7 +418,7 @@ void Verifier::VerifyAttrs(Attributes Attrs, const Type *Ty,
   }
   Attributes FnCheckAttr = Attrs & Attribute::FunctionOnly;
   Assert1(!FnCheckAttr, "Attribute " + Attribute::getAsString(FnCheckAttr) +
-          " only applies to return values!", V);
+          " only applies to functions!", V);
   
   for (unsigned i = 0;
        i < array_lengthof(Attribute::MutuallyIncompatible); ++i) {
@@ -1347,8 +1347,10 @@ void Verifier::visitIntrinsicFunctionCall(Intrinsic::ID ID, CallInst &CI) {
   case Intrinsic::gcwrite:
   case Intrinsic::gcread:
     if (ID == Intrinsic::gcroot) {
-      Assert1(isa<AllocaInst>(CI.getOperand(1)->stripPointerCasts()),
-              "llvm.gcroot parameter #1 must be an alloca.", &CI);
+      AllocaInst *AI =
+        dyn_cast<AllocaInst>(CI.getOperand(1)->stripPointerCasts());
+      Assert1(AI && isa<PointerType>(AI->getType()->getElementType()),
+              "llvm.gcroot parameter #1 must be a pointer alloca.", &CI);
       Assert1(isa<Constant>(CI.getOperand(2)),
               "llvm.gcroot parameter #2 must be a constant.", &CI);
     }
@@ -1361,6 +1363,14 @@ void Verifier::visitIntrinsicFunctionCall(Intrinsic::ID ID, CallInst &CI) {
             "llvm.init_trampoline parameter #2 must resolve to a function.",
             &CI);
     break;
+  case Intrinsic::prefetch:
+    Assert1(isa<ConstantInt>(CI.getOperand(2)) &&
+            isa<ConstantInt>(CI.getOperand(3)) &&
+            cast<ConstantInt>(CI.getOperand(2))->getZExtValue() < 2 &&
+            cast<ConstantInt>(CI.getOperand(3))->getZExtValue() < 4,
+            "invalid arguments to llvm.prefetch",
+            &CI);
+    break;
   }
 }