Skip to content

Commit

Permalink
[tti] Consolidate getOperandInfo without OperandValueProperties copie…
Browse files Browse the repository at this point in the history
…s [nfc]
  • Loading branch information
preames committed Aug 19, 2022
1 parent b0f4678 commit b0a2c48
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 8 deletions.
2 changes: 2 additions & 0 deletions llvm/include/llvm/Analysis/TargetTransformInfo.h
Expand Up @@ -1032,6 +1032,8 @@ class TargetTransformInfo {
/// Collect properties of V used in cost analysis, e.g. OP_PowerOf2.
static OperandValueKind getOperandInfo(const Value *V,
OperandValueProperties &OpProps);
static OperandValueKind getOperandInfo(const Value *V);


/// This is an approximation of reciprocal throughput of a math/logic op.
/// A higher cost indicates less expected throughput.
Expand Down
3 changes: 1 addition & 2 deletions llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
Expand Up @@ -1100,8 +1100,7 @@ class TargetTransformInfoImplCRTPBase : public TargetTransformInfoImplBase {
case Instruction::Store: {
auto *SI = cast<StoreInst>(U);
Type *ValTy = U->getOperand(0)->getType();
TTI::OperandValueProperties OpVP = TTI::OP_None;
TTI::OperandValueKind OpVK = TTI::getOperandInfo(U->getOperand(0), OpVP);
TTI::OperandValueKind OpVK = TTI::getOperandInfo(U->getOperand(0));
return TargetTTI->getMemoryOpCost(Opcode, ValTy, SI->getAlign(),
SI->getPointerAddressSpace(), CostKind,
OpVK, I);
Expand Down
6 changes: 6 additions & 0 deletions llvm/lib/Analysis/TargetTransformInfo.cpp
Expand Up @@ -762,6 +762,12 @@ TargetTransformInfo::getOperandInfo(const Value *V,
return OpInfo;
}

TargetTransformInfo::OperandValueKind
TargetTransformInfo::getOperandInfo(const Value *V) {
OperandValueProperties Discard = OP_None;
return getOperandInfo(V, Discard);
}

InstructionCost TargetTransformInfo::getArithmeticInstrCost(
unsigned Opcode, Type *Ty, TTI::TargetCostKind CostKind,
OperandValueKind Opd1Info, OperandValueKind Opd2Info,
Expand Down
6 changes: 2 additions & 4 deletions llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
Expand Up @@ -6398,8 +6398,7 @@ LoopVectorizationCostModel::getConsecutiveMemOpCost(Instruction *I,
Cost += TTI.getMaskedMemoryOpCost(I->getOpcode(), VectorTy, Alignment, AS,
CostKind);
} else {
TTI::OperandValueProperties OpVP = TTI::OP_None;
TTI::OperandValueKind OpVK = TTI::getOperandInfo(I->getOperand(0), OpVP);
TTI::OperandValueKind OpVK = TTI::getOperandInfo(I->getOperand(0));
Cost += TTI.getMemoryOpCost(I->getOpcode(), VectorTy, Alignment, AS,
CostKind, OpVK, I);
}
Expand Down Expand Up @@ -6679,8 +6678,7 @@ LoopVectorizationCostModel::getMemoryInstructionCost(Instruction *I,
const Align Alignment = getLoadStoreAlignment(I);
unsigned AS = getLoadStoreAddressSpace(I);

TTI::OperandValueProperties OpVP = TTI::OP_None;
TTI::OperandValueKind OpVK = TTI::getOperandInfo(I->getOperand(0), OpVP);
TTI::OperandValueKind OpVK = TTI::getOperandInfo(I->getOperand(0));
return TTI.getAddressComputationCost(ValTy) +
TTI.getMemoryOpCost(I->getOpcode(), ValTy, Alignment, AS,
TTI::TCK_RecipThroughput, OpVK, I);
Expand Down
3 changes: 1 addition & 2 deletions llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
Expand Up @@ -6483,8 +6483,7 @@ InstructionCost BoUpSLP::getEntryCost(const TreeEntry *E,
auto *SI =
cast<StoreInst>(IsReorder ? VL[E->ReorderIndices.front()] : VL0);
Align Alignment = SI->getAlign();
TTI::OperandValueProperties OpVP = TTI::OP_None;
TTI::OperandValueKind OpVK = TTI::getOperandInfo(SI->getOperand(0), OpVP);
TTI::OperandValueKind OpVK = TTI::getOperandInfo(SI->getOperand(0));
InstructionCost ScalarEltCost = TTI->getMemoryOpCost(
Instruction::Store, ScalarTy, Alignment, 0, CostKind, OpVK, VL0);
InstructionCost ScalarStCost = VecTy->getNumElements() * ScalarEltCost;
Expand Down

0 comments on commit b0a2c48

Please sign in to comment.