diff options
author | Dan Gohman <gohman@apple.com> | 2007-08-16 22:06:45 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2007-08-16 22:06:45 +0000 |
commit | 88ac781644b4dfa23773addfccd485b0bfc3d48a (patch) | |
tree | 9c3d1f12417ef1030ca4e22ca88c58abbe297c5e /llvm/lib | |
parent | 221a43604e857fb7ef4ea4693cec4795dfd1edb2 (diff) | |
download | bcm5719-llvm-88ac781644b4dfa23773addfccd485b0bfc3d48a.tar.gz bcm5719-llvm-88ac781644b4dfa23773addfccd485b0bfc3d48a.zip |
Fix the verification for overloaded intrinsic types. Check that they are
what they're supposed to be before using them.
llvm-svn: 41130
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/VMCore/Verifier.cpp | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/llvm/lib/VMCore/Verifier.cpp b/llvm/lib/VMCore/Verifier.cpp index 0c4ca642098..ae27651ee5c 100644 --- a/llvm/lib/VMCore/Verifier.cpp +++ b/llvm/lib/VMCore/Verifier.cpp @@ -1144,6 +1144,15 @@ void Verifier::VerifyIntrinsicPrototype(Intrinsic::ID ID, } } } 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 @@ void Verifier::VerifyIntrinsicPrototype(Intrinsic::ID ID, 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 @@ void Verifier::VerifyIntrinsicPrototype(Intrinsic::ID ID, "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)) { |