mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-14 07:31:53 +00:00
Reduce code duplication resulting from the ConstantVector/ConstantDataVector split.
No intended functionality change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201344 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
7fd806d94a
commit
8ed2c8e99f
@ -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<ConstantDataVector>(V))) {
|
||||
if (isa<ConstantVector>(V) || isa<ConstantDataVector>(V)) {
|
||||
OpInfo = TargetTransformInfo::OK_NonUniformConstantValue;
|
||||
if (CDV->getSplatValue() != NULL)
|
||||
OpInfo = TargetTransformInfo::OK_UniformConstantValue;
|
||||
}
|
||||
|
||||
ConstantVector *CV = 0;
|
||||
if ((CV = dyn_cast<ConstantVector>(V))) {
|
||||
OpInfo = TargetTransformInfo::OK_NonUniformConstantValue;
|
||||
if (CV->getSplatValue() != NULL)
|
||||
if (cast<Constant>(V)->getSplatValue() != NULL)
|
||||
OpInfo = TargetTransformInfo::OK_UniformConstantValue;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user