aboutsummaryrefslogtreecommitdiffstats
path: root/lib/VMCore/Type.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-11-10 01:40:59 +0000
committerChris Lattner <sabre@nondot.org>2005-11-10 01:40:59 +0000
commitd115ef897359c12d451a96ad6330249372e38ab2 (patch)
tree18c0cbbdcc0860e6db3601754144834b0bc53f7e /lib/VMCore/Type.cpp
parentde202b3cda00f17ba2c047be7270b51f9585a413 (diff)
downloadexternal_llvm-d115ef897359c12d451a96ad6330249372e38ab2.zip
external_llvm-d115ef897359c12d451a96ad6330249372e38ab2.tar.gz
external_llvm-d115ef897359c12d451a96ad6330249372e38ab2.tar.bz2
Force packed vectors to be a power of two in length.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24264 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/Type.cpp')
-rw-r--r--lib/VMCore/Type.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/VMCore/Type.cpp b/lib/VMCore/Type.cpp
index 4eb744d..9b9ca4f 100644
--- a/lib/VMCore/Type.cpp
+++ b/lib/VMCore/Type.cpp
@@ -19,6 +19,7 @@
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/SCCIterator.h"
#include "llvm/ADT/STLExtras.h"
+#include "llvm/Support/MathExtras.h"
#include <algorithm>
#include <iostream>
using namespace llvm;
@@ -1005,6 +1006,7 @@ static TypeMap<PackedValType, PackedType> PackedTypes;
PackedType *PackedType::get(const Type *ElementType, unsigned NumElements) {
assert(ElementType && "Can't get packed of null types!");
+ assert(isPowerOf2_32(NumElements) && "Vector length should be a power of 2!");
PackedValType PVT(ElementType, NumElements);
PackedType *PT = PackedTypes.get(PVT);