aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/ConstantFold.cpp
diff options
context:
space:
mode:
authorJiangning Liu <jiangning.liu@arm.com>2014-08-21 02:12:35 +0000
committerJiangning Liu <jiangning.liu@arm.com>2014-08-21 02:12:35 +0000
commit950844fadbb1e9129a9b6f18373cf9a272deea76 (patch)
treec1de743d4550226fc9e4f025f67c80170b5205c7 /llvm/lib/IR/ConstantFold.cpp
parent65b31a903b544f2bec0a40d761b1c774115026e8 (diff)
downloadllvm-950844fadbb1e9129a9b6f18373cf9a272deea76.zip
llvm-950844fadbb1e9129a9b6f18373cf9a272deea76.tar.gz
llvm-950844fadbb1e9129a9b6f18373cf9a272deea76.tar.bz2
Fix a bug around truncating vector in const prop.
In constant folding stage, "TRUNC" can't handle vector data type. llvm-svn: 216149
Diffstat (limited to 'llvm/lib/IR/ConstantFold.cpp')
-rw-r--r--llvm/lib/IR/ConstantFold.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/llvm/lib/IR/ConstantFold.cpp b/llvm/lib/IR/ConstantFold.cpp
index 9124c11..b96d154 100644
--- a/llvm/lib/IR/ConstantFold.cpp
+++ b/llvm/lib/IR/ConstantFold.cpp
@@ -674,6 +674,9 @@ Constant *llvm::ConstantFoldCastInstruction(unsigned opc, Constant *V,
}
return nullptr;
case Instruction::Trunc: {
+ if (V->getType()->isVectorTy())
+ return nullptr;
+
uint32_t DestBitWidth = cast<IntegerType>(DestTy)->getBitWidth();
if (ConstantInt *CI = dyn_cast<ConstantInt>(V)) {
return ConstantInt::get(V->getContext(),