aboutsummaryrefslogtreecommitdiffstats
path: root/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
commitbc53ca1b530aa57280c7a373ea518278abb6ae37 (patch)
tree7884951e017c5629fb68a460aa38c93265eb011e /lib/VMCore/ConstantFold.cpp
parent915eeb488786379250808d47668c43e010efe566 (diff)
downloadexternal_llvm-bc53ca1b530aa57280c7a373ea518278abb6ae37.tar.gz
external_llvm-bc53ca1b530aa57280c7a373ea518278abb6ae37.tar.bz2
external_llvm-bc53ca1b530aa57280c7a373ea518278abb6ae37.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! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125459 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/ConstantFold.cpp')
-rw-r--r--lib/VMCore/ConstantFold.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/VMCore/ConstantFold.cpp b/lib/VMCore/ConstantFold.cpp
index 0ec343f07d..1b50c4aa9d 100644
--- a/lib/VMCore/ConstantFold.cpp
+++ b/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: