[llvm-commits] [llvm] r41130 - /llvm/trunk/lib/VMCore/Verifier.cpp
Dan Gohman
djg at cray.com
Thu Aug 16 15:06:45 PDT 2007
Author: djg
Date: Thu Aug 16 17:06:45 2007
New Revision: 41130
URL: http://llvm.org/viewvc/llvm-project?rev=41130&view=rev
Log:
Fix the verification for overloaded intrinsic types. Check that they are
what they're supposed to be before using them.
Modified:
llvm/trunk/lib/VMCore/Verifier.cpp
Modified: llvm/trunk/lib/VMCore/Verifier.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Verifier.cpp?rev=41130&r1=41129&r2=41130&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Verifier.cpp (original)
+++ llvm/trunk/lib/VMCore/Verifier.cpp Thu Aug 16 17:06:45 2007
@@ -1144,6 +1144,15 @@
}
}
} else if (VT == MVT::iAny) {
+ if (!EltTy->isInteger()) {
+ if (ArgNo == 0)
+ CheckFailed("Intrinsic result type is not "
+ "an integer type.", F);
+ else
+ CheckFailed("Intrinsic parameter #" + utostr(ArgNo-1) + " is not "
+ "an integer type.", F);
+ break;
+ }
unsigned GotBits = cast<IntegerType>(EltTy)->getBitWidth();
Suffix += ".";
if (EltTy != Ty)
@@ -1158,10 +1167,6 @@
break;
}
} else if (VT == MVT::fAny) {
- Suffix += ".";
- if (EltTy != Ty)
- Suffix += "v" + utostr(NumElts);
- Suffix += MVT::getValueTypeString(MVT::getValueType(EltTy));
if (!EltTy->isFloatingPoint()) {
if (ArgNo == 0)
CheckFailed("Intrinsic result type is not "
@@ -1171,10 +1176,18 @@
"a floating-point type.", F);
break;
}
+ Suffix += ".";
+ if (EltTy != Ty)
+ Suffix += "v" + utostr(NumElts);
+ Suffix += MVT::getValueTypeString(MVT::getValueType(EltTy));
} else if (VT == MVT::iPTR) {
if (!isa<PointerType>(Ty)) {
- CheckFailed("Intrinsic parameter #" + utostr(ArgNo-1) + " is not a "
- "pointer and a pointer is required.", F);
+ if (ArgNo == 0)
+ CheckFailed("Intrinsic result type is not a "
+ "pointer and a pointer is required.", F);
+ else
+ CheckFailed("Intrinsic parameter #" + utostr(ArgNo-1) + " is not a "
+ "pointer and a pointer is required.", F);
break;
}
} else if (MVT::isVector(VT)) {
More information about the llvm-commits
mailing list