diff options
author | Dan Gohman <gohman@apple.com> | 2007-10-31 21:36:31 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2007-10-31 21:36:31 +0000 |
commit | 2cda9399deed8a50e95848716212b500c5b2d396 (patch) | |
tree | 421d13ee95f59c98dccf32c51d68e7d0de636a9f /lib/VMCore/ConstantFold.cpp | |
parent | c570e33a61432b911775528674bcf75c2fd06755 (diff) | |
download | external_llvm-2cda9399deed8a50e95848716212b500c5b2d396.zip external_llvm-2cda9399deed8a50e95848716212b500c5b2d396.tar.gz external_llvm-2cda9399deed8a50e95848716212b500c5b2d396.tar.bz2 |
Fix a regression in test/CodeGen/X86/2007-04-24-VectorCrash.ll introduced
by r43510. Gracefully handle constants with vector type that aren't
ConstantVector or ConstantAggregateZero.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43579 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/ConstantFold.cpp')
-rw-r--r-- | lib/VMCore/ConstantFold.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/VMCore/ConstantFold.cpp b/lib/VMCore/ConstantFold.cpp index 2f2c618..257e481 100644 --- a/lib/VMCore/ConstantFold.cpp +++ b/lib/VMCore/ConstantFold.cpp @@ -716,10 +716,8 @@ Constant *llvm::ConstantFoldBinaryInstruction(unsigned Opcode, } else if (const VectorType *VTy = dyn_cast<VectorType>(C1->getType())) { const ConstantVector *CP1 = dyn_cast<ConstantVector>(C1); const ConstantVector *CP2 = dyn_cast<ConstantVector>(C2); - assert((CP1 != NULL || isa<ConstantAggregateZero>(C1)) && - "Unexpected kind of vector constant!"); - assert((CP2 != NULL || isa<ConstantAggregateZero>(C2)) && - "Unexpected kind of vector constant!"); + if ((CP1 != NULL || isa<ConstantAggregateZero>(C1)) && + (CP2 != NULL || isa<ConstantAggregateZero>(C2))) { switch (Opcode) { default: break; @@ -747,6 +745,7 @@ Constant *llvm::ConstantFoldBinaryInstruction(unsigned Opcode, return EvalVectorOp(CP1, CP2, VTy, ConstantExpr::getOr); case Instruction::Xor: return EvalVectorOp(CP1, CP2, VTy, ConstantExpr::getXor); + } } } |