aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Transforms/InstCombine/InstructionCombining.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2012-01-27 03:08:05 +0000
committerChris Lattner <sabre@nondot.org>2012-01-27 03:08:05 +0000
commita78fa8cc2dd6d2ffe5e4fe605f38aae7b3d2fb7a (patch)
tree86baf632ff9cede6ae0504249b7075282f9fa227 /lib/Transforms/InstCombine/InstructionCombining.cpp
parent2b343702aac08ddff4191890a8745616022c831f (diff)
downloadexternal_llvm-a78fa8cc2dd6d2ffe5e4fe605f38aae7b3d2fb7a.zip
external_llvm-a78fa8cc2dd6d2ffe5e4fe605f38aae7b3d2fb7a.tar.gz
external_llvm-a78fa8cc2dd6d2ffe5e4fe605f38aae7b3d2fb7a.tar.bz2
continue making the world safe for ConstantDataVector. At this point,
we should (theoretically optimize and codegen ConstantDataVector as well as ConstantVector. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149116 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/InstCombine/InstructionCombining.cpp')
-rw-r--r--lib/Transforms/InstCombine/InstructionCombining.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/Transforms/InstCombine/InstructionCombining.cpp b/lib/Transforms/InstCombine/InstructionCombining.cpp
index 86e491b..64ed817 100644
--- a/lib/Transforms/InstCombine/InstructionCombining.cpp
+++ b/lib/Transforms/InstCombine/InstructionCombining.cpp
@@ -495,8 +495,10 @@ Value *InstCombiner::dyn_castNegVal(Value *V) const {
if (ConstantInt *C = dyn_cast<ConstantInt>(V))
return ConstantExpr::getNeg(C);
- if (ConstantVector *C = dyn_cast<ConstantVector>(V))
- if (C->getType()->getElementType()->isIntegerTy())
+ if (Constant *C = dyn_cast<Constant>(V))
+ // FIXME: Remove ConstantVector
+ if ((isa<ConstantVector>(C) || isa<ConstantDataVector>(C)) &&
+ C->getType()->getVectorElementType()->isIntegerTy())
return ConstantExpr::getNeg(C);
return 0;
@@ -514,8 +516,10 @@ Value *InstCombiner::dyn_castFNegVal(Value *V) const {
if (ConstantFP *C = dyn_cast<ConstantFP>(V))
return ConstantExpr::getFNeg(C);
- if (ConstantVector *C = dyn_cast<ConstantVector>(V))
- if (C->getType()->getElementType()->isFloatingPointTy())
+ if (Constant *C = dyn_cast<Constant>(V))
+ // FIXME: Remove ConstantVector
+ if ((isa<ConstantVector>(C) || isa<ConstantDataVector>(C)) &&
+ C->getType()->getVectorElementType()->isFloatingPointTy())
return ConstantExpr::getFNeg(C);
return 0;