diff --git a/llvm/lib/Analysis/CostModel.cpp b/llvm/lib/Analysis/CostModel.cpp index 898da8d0e8d1..8eb5f6857e26 100644 --- a/llvm/lib/Analysis/CostModel.cpp +++ b/llvm/lib/Analysis/CostModel.cpp @@ -99,17 +99,9 @@ static TargetTransformInfo::OperandValueKind getOperandInfo(Value *V) { TargetTransformInfo::OK_AnyValue; // Check for a splat of a constant or for a non uniform vector of constants. - ConstantDataVector *CDV = 0; - if ((CDV = dyn_cast(V))) { + if (isa(V) || isa(V)) { OpInfo = TargetTransformInfo::OK_NonUniformConstantValue; - if (CDV->getSplatValue() != NULL) - OpInfo = TargetTransformInfo::OK_UniformConstantValue; - } - - ConstantVector *CV = 0; - if ((CV = dyn_cast(V))) { - OpInfo = TargetTransformInfo::OK_NonUniformConstantValue; - if (CV->getSplatValue() != NULL) + if (cast(V)->getSplatValue() != NULL) OpInfo = TargetTransformInfo::OK_UniformConstantValue; } diff --git a/llvm/lib/Transforms/Vectorize/BBVectorize.cpp b/llvm/lib/Transforms/Vectorize/BBVectorize.cpp index f59dd2160a9d..6ef202013068 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(IOp)) { - if (ConstantDataVector *CDVJ = dyn_cast(JOp)) { - Op2VK = TargetTransformInfo::OK_NonUniformConstantValue; - Constant *SplatValue = CDVI->getSplatValue(); - if (SplatValue != NULL && SplatValue == CDVJ->getSplatValue()) - Op2VK = TargetTransformInfo::OK_UniformConstantValue; - } - } - - if (ConstantVector *CVI = dyn_cast(IOp)) { - if (ConstantVector *CVJ = dyn_cast(JOp)) { - Op2VK = TargetTransformInfo::OK_NonUniformConstantValue; - Constant *SplatValue = CVI->getSplatValue(); - if (SplatValue != NULL && SplatValue == CVJ->getSplatValue()) - Op2VK = TargetTransformInfo::OK_UniformConstantValue; - } + if ((isa(IOp) || isa(IOp)) && + (isa(JOp) || isa(JOp))) { + Op2VK = TargetTransformInfo::OK_NonUniformConstantValue; + Constant *SplatValue = cast(IOp)->getSplatValue(); + if (SplatValue != NULL && + SplatValue == cast(JOp)->getSplatValue()) + Op2VK = TargetTransformInfo::OK_UniformConstantValue; } } } diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp index ecbab63acf02..d7d66e791616 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(Op2)) Op2VK = TargetTransformInfo::OK_UniformConstantValue; - else if (ConstantDataVector *CDV = dyn_cast(Op2)) { + else if (isa(Op2) || isa(Op2)) { Op2VK = TargetTransformInfo::OK_NonUniformConstantValue; - if (CDV->getSplatValue() != NULL) - Op2VK = TargetTransformInfo::OK_UniformConstantValue; - } else if (ConstantVector *CV = dyn_cast(Op2)) { - Op2VK = TargetTransformInfo::OK_NonUniformConstantValue; - if (CV->getSplatValue() != NULL) + if (cast(Op2)->getSplatValue() != NULL) Op2VK = TargetTransformInfo::OK_UniformConstantValue; }