diff options
author | Bob Wilson <bob.wilson@apple.com> | 2009-01-07 23:44:27 +0000 |
---|---|---|
committer | Bob Wilson <bob.wilson@apple.com> | 2009-01-07 23:44:27 +0000 |
commit | 37c48b727017c2fe36fbd380aeee74a2a564df7b (patch) | |
tree | 77777b8bb8d437e91a64a3d32a62ef409781611a /lib/VMCore/Verifier.cpp | |
parent | ed94023eb3a5ea003b8c2d6ab617ba159723154a (diff) | |
download | external_llvm-37c48b727017c2fe36fbd380aeee74a2a564df7b.zip external_llvm-37c48b727017c2fe36fbd380aeee74a2a564df7b.tar.gz external_llvm-37c48b727017c2fe36fbd380aeee74a2a564df7b.tar.bz2 |
Assert that VectorType::getTruncatedElementVectorType is not used with
odd bit-width vector elements. Add a check in the verifier for this also.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61899 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/Verifier.cpp')
-rw-r--r-- | lib/VMCore/Verifier.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/VMCore/Verifier.cpp b/lib/VMCore/Verifier.cpp index 4a79154..f9ad41b 100644 --- a/lib/VMCore/Verifier.cpp +++ b/lib/VMCore/Verifier.cpp @@ -1395,16 +1395,22 @@ bool Verifier::PerformTypeCheck(Intrinsic::ID ID, Function *F, const Type *Ty, // type. if ((Match & (ExtendedElementVectorType | TruncatedElementVectorType)) != 0) { - if (!VTy) { + const IntegerType *IEltTy = dyn_cast<IntegerType>(EltTy); + if (!VTy || !IEltTy) { CheckFailed("Intrinsic parameter #" + utostr(ArgNo - 1) + " is not " - "a vector type.", F); + "an integral vector type.", F); return false; } // Adjust the current Ty (in the opposite direction) rather than // the type being matched against. - if ((Match & ExtendedElementVectorType) != 0) + if ((Match & ExtendedElementVectorType) != 0) { + if ((IEltTy->getBitWidth() & 1) != 0) { + CheckFailed("Intrinsic parameter #" + utostr(ArgNo - 1) + " vector " + "element bit-width is odd.", F); + return false; + } Ty = VectorType::getTruncatedElementVectorType(VTy); - else + } else Ty = VectorType::getExtendedElementVectorType(VTy); Match &= ~(ExtendedElementVectorType | TruncatedElementVectorType); } |