diff options
author | Nate Begeman <natebegeman@mac.com> | 2008-07-29 15:49:41 +0000 |
---|---|---|
committer | Nate Begeman <natebegeman@mac.com> | 2008-07-29 15:49:41 +0000 |
commit | 5bc1ea0736a5785ed596d58beeff2ab23909e33d (patch) | |
tree | 873c527b697e72ea9a3cc6b65f14717777db584a /lib/VMCore/Verifier.cpp | |
parent | 75cf9cc527c6ef3097dcefab173e93716a5a3e4a (diff) |
Add vector shifts to the IR, patch by Eli Friedman.
CodeGen & Clang work coming next.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54161 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/Verifier.cpp')
-rw-r--r-- | lib/VMCore/Verifier.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/VMCore/Verifier.cpp b/lib/VMCore/Verifier.cpp index 4711689f44..96f2076f1a 100644 --- a/lib/VMCore/Verifier.cpp +++ b/lib/VMCore/Verifier.cpp @@ -973,8 +973,10 @@ void Verifier::visitBinaryOperator(BinaryOperator &B) { case Instruction::Shl: case Instruction::LShr: case Instruction::AShr: - Assert1(B.getType()->isInteger(), - "Shift must return an integer result!", &B); + Assert1(B.getType()->isInteger() || + (isa<VectorType>(B.getType()) && + cast<VectorType>(B.getType())->getElementType()->isInteger()), + "Shifts only work with integral types!", &B); Assert1(B.getType() == B.getOperand(0)->getType(), "Shift return type must be same as operands!", &B); /* FALL THROUGH */ @@ -1041,9 +1043,13 @@ void Verifier::visitShuffleVectorInst(ShuffleVectorInst &SV) { // Check to see if Mask is valid. if (const ConstantVector *MV = dyn_cast<ConstantVector>(SV.getOperand(2))) { for (unsigned i = 0, e = MV->getNumOperands(); i != e; ++i) { - Assert1(isa<ConstantInt>(MV->getOperand(i)) || - isa<UndefValue>(MV->getOperand(i)), - "Invalid shufflevector shuffle mask!", &SV); + if (ConstantInt* CI = dyn_cast<ConstantInt>(MV->getOperand(i))) { + Assert1(!CI->uge(MV->getNumOperands()*2), + "Invalid shufflevector shuffle mask!", &SV); + } else { + Assert1(isa<UndefValue>(MV->getOperand(i)), + "Invalid shufflevector shuffle mask!", &SV); + } } } else { Assert1(isa<UndefValue>(SV.getOperand(2)) || |