summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Vectorize/BBVectorize.cpp23
-rw-r--r--llvm/lib/Transforms/Vectorize/LoopVectorize.cpp8
2 files changed, 9 insertions, 22 deletions
diff --git a/llvm/lib/Transforms/Vectorize/BBVectorize.cpp b/llvm/lib/Transforms/Vectorize/BBVectorize.cpp
index f59dd2160a9..6ef20201306 100644
--- a/llvm/lib/Transforms/Vectorize/BBVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/BBVectorize.cpp
@@ -1043,22 +1043,13 @@ namespace {
// of constants.
Value *IOp = I->getOperand(1);
Value *JOp = J->getOperand(1);
- if (ConstantDataVector *CDVI = dyn_cast<ConstantDataVector>(IOp)) {
- if (ConstantDataVector *CDVJ = dyn_cast<ConstantDataVector>(JOp)) {
- Op2VK = TargetTransformInfo::OK_NonUniformConstantValue;
- Constant *SplatValue = CDVI->getSplatValue();
- if (SplatValue != NULL && SplatValue == CDVJ->getSplatValue())
- Op2VK = TargetTransformInfo::OK_UniformConstantValue;
- }
- }
-
- if (ConstantVector *CVI = dyn_cast<ConstantVector>(IOp)) {
- if (ConstantVector *CVJ = dyn_cast<ConstantVector>(JOp)) {
- Op2VK = TargetTransformInfo::OK_NonUniformConstantValue;
- Constant *SplatValue = CVI->getSplatValue();
- if (SplatValue != NULL && SplatValue == CVJ->getSplatValue())
- Op2VK = TargetTransformInfo::OK_UniformConstantValue;
- }
+ if ((isa<ConstantVector>(IOp) || isa<ConstantDataVector>(IOp)) &&
+ (isa<ConstantVector>(JOp) || isa<ConstantDataVector>(JOp))) {
+ Op2VK = TargetTransformInfo::OK_NonUniformConstantValue;
+ Constant *SplatValue = cast<Constant>(IOp)->getSplatValue();
+ if (SplatValue != NULL &&
+ SplatValue == cast<Constant>(JOp)->getSplatValue())
+ Op2VK = TargetTransformInfo::OK_UniformConstantValue;
}
}
}
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index ecbab63acf0..d7d66e79161 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -5496,13 +5496,9 @@ LoopVectorizationCostModel::getInstructionCost(Instruction *I, unsigned VF) {
// Check for a splat of a constant or for a non uniform vector of constants.
if (isa<ConstantInt>(Op2))
Op2VK = TargetTransformInfo::OK_UniformConstantValue;
- else if (ConstantDataVector *CDV = dyn_cast<ConstantDataVector>(Op2)) {
+ else if (isa<ConstantVector>(Op2) || isa<ConstantDataVector>(Op2)) {
Op2VK = TargetTransformInfo::OK_NonUniformConstantValue;
- if (CDV->getSplatValue() != NULL)
- Op2VK = TargetTransformInfo::OK_UniformConstantValue;
- } else if (ConstantVector *CV = dyn_cast<ConstantVector>(Op2)) {
- Op2VK = TargetTransformInfo::OK_NonUniformConstantValue;
- if (CV->getSplatValue() != NULL)
+ if (cast<Constant>(Op2)->getSplatValue() != NULL)
Op2VK = TargetTransformInfo::OK_UniformConstantValue;
}
OpenPOWER on IntegriCloud