summaryrefslogtreecommitdiffstats
path: root/llvm/lib/VMCore/ConstantFold.cpp
diff options
context:
space:
mode:
authorNadav Rotem <nadav.rotem@intel.com>2011-02-13 15:45:34 +0000
committerNadav Rotem <nadav.rotem@intel.com>2011-02-13 15:45:34 +0000
commit27b848afb0ec0f2acb3ebab3a56ec1f3074ebb3d (patch)
treebc5b09e3135ae977abbca6e205529491a5153d34 /llvm/lib/VMCore/ConstantFold.cpp
parentd5f0b1148aea2d79ee15257348491a930ec04f8e (diff)
downloadbcm5719-llvm-27b848afb0ec0f2acb3ebab3a56ec1f3074ebb3d.tar.gz
bcm5719-llvm-27b848afb0ec0f2acb3ebab3a56ec1f3074ebb3d.zip
Fix a regression from r125393;
It caused a crash in MultiSource/Benchmarks/Bullet. Opt hit an assertion with "opt -std-compile-opts" because Constant::getAllOnesValue doesn't know how to handle floats. This patch added a test to reproduce the problem and a check that the destination vector is of integer type. Thank you Benjamin! llvm-svn: 125459
Diffstat (limited to 'llvm/lib/VMCore/ConstantFold.cpp')
-rw-r--r--llvm/lib/VMCore/ConstantFold.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/VMCore/ConstantFold.cpp b/llvm/lib/VMCore/ConstantFold.cpp
index 0ec343f07d2..1b50c4aa9dd 100644
--- a/llvm/lib/VMCore/ConstantFold.cpp
+++ b/llvm/lib/VMCore/ConstantFold.cpp
@@ -43,7 +43,8 @@ using namespace llvm;
static Constant *BitCastConstantVector(ConstantVector *CV,
const VectorType *DstTy) {
- if (CV->isAllOnesValue()) return Constant::getAllOnesValue(DstTy);
+ if (CV->isAllOnesValue() && DstTy->getElementType()->isIntegerTy())
+ return Constant::getAllOnesValue(DstTy);
if (CV->isNullValue()) return Constant::getNullValue(DstTy);
// If this cast changes element count then we can't handle it here:
OpenPOWER on IntegriCloud