diff options
author | Chris Lattner <sabre@nondot.org> | 2010-02-01 20:04:40 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-02-01 20:04:40 +0000 |
commit | 94eb4b285bf901f1b62d4d35958e266087b669e8 (patch) | |
tree | 32631d79cf7a50070e0e2c8aa02086bbbf9e1d6c /llvm/lib | |
parent | 0b30cfc57e323e5cbaa6514c443af5a74fe0631b (diff) | |
download | bcm5719-llvm-94eb4b285bf901f1b62d4d35958e266087b669e8.tar.gz bcm5719-llvm-94eb4b285bf901f1b62d4d35958e266087b669e8.zip |
fix PR6195, a bug constant folding scalar -> vector compares.
llvm-svn: 94997
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/VMCore/ConstantFold.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/llvm/lib/VMCore/ConstantFold.cpp b/llvm/lib/VMCore/ConstantFold.cpp index 5e4b4720972..d537b273761 100644 --- a/llvm/lib/VMCore/ConstantFold.cpp +++ b/llvm/lib/VMCore/ConstantFold.cpp @@ -2017,10 +2017,12 @@ Constant *llvm::ConstantFoldCompareInstruction(LLVMContext &Context, return ConstantInt::get(Type::getInt1Ty(Context), Result); // If the right hand side is a bitcast, try using its inverse to simplify - // it by moving it to the left hand side. + // it by moving it to the left hand side. We can't do this if it would turn + // a vector compare into scalar compare of visa versa. if (ConstantExpr *CE2 = dyn_cast<ConstantExpr>(C2)) { - if (CE2->getOpcode() == Instruction::BitCast) { - Constant *CE2Op0 = CE2->getOperand(0); + Constant *CE2Op0 = CE2->getOperand(0); + if (CE2->getOpcode() == Instruction::BitCast && + isa<VectorType>(CE2->getType()) ==isa<VectorType>(CE2Op0->getType())){ Constant *Inverse = ConstantExpr::getBitCast(C1, CE2Op0->getType()); return ConstantExpr::getICmp(pred, Inverse, CE2Op0); } |