aboutsummaryrefslogtreecommitdiffstats
path: root/lib/VMCore
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2009-03-14 17:09:17 +0000
committerDan Gohman <gohman@apple.com>2009-03-14 17:09:17 +0000
commitc1317939045d1907f1e4a20315feceb0afa384a2 (patch)
tree133eb060fd6127555612613aceb20462a4aed2d5 /lib/VMCore
parent8d8ba38f98c465a0d95501361561baecbc104d59 (diff)
downloadexternal_llvm-c1317939045d1907f1e4a20315feceb0afa384a2.zip
external_llvm-c1317939045d1907f1e4a20315feceb0afa384a2.tar.gz
external_llvm-c1317939045d1907f1e4a20315feceb0afa384a2.tar.bz2
Apply a patch by Micah Villmow to fix AsmParser to accept vector
shift constant expressions, and add support for folding vector shift constant expressions. This fixes PR3802. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67010 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore')
-rw-r--r--lib/VMCore/ConstantFold.cpp6
-rw-r--r--lib/VMCore/Constants.cpp2
2 files changed, 7 insertions, 1 deletions
diff --git a/lib/VMCore/ConstantFold.cpp b/lib/VMCore/ConstantFold.cpp
index f284711..7e4902f 100644
--- a/lib/VMCore/ConstantFold.cpp
+++ b/lib/VMCore/ConstantFold.cpp
@@ -832,6 +832,12 @@ Constant *llvm::ConstantFoldBinaryInstruction(unsigned Opcode,
return EvalVectorOp(CP1, CP2, VTy, ConstantExpr::getOr);
case Instruction::Xor:
return EvalVectorOp(CP1, CP2, VTy, ConstantExpr::getXor);
+ case Instruction::LShr:
+ return EvalVectorOp(CP1, CP2, VTy, ConstantExpr::getLShr);
+ case Instruction::AShr:
+ return EvalVectorOp(CP1, CP2, VTy, ConstantExpr::getAShr);
+ case Instruction::Shl:
+ return EvalVectorOp(CP1, CP2, VTy, ConstantExpr::getShl);
}
}
}
diff --git a/lib/VMCore/Constants.cpp b/lib/VMCore/Constants.cpp
index 0be2811..ed1e04a 100644
--- a/lib/VMCore/Constants.cpp
+++ b/lib/VMCore/Constants.cpp
@@ -2095,7 +2095,7 @@ Constant *ConstantExpr::get(unsigned Opcode, Constant *C1, Constant *C2) {
case Instruction::LShr:
case Instruction::AShr:
assert(C1->getType() == C2->getType() && "Op types should be identical!");
- assert(C1->getType()->isInteger() &&
+ assert(C1->getType()->isIntOrIntVector() &&
"Tried to create a shift operation on a non-integer type!");
break;
default: