From: Philip Reames Date: Fri, 19 Aug 2022 23:21:14 +0000 (-0700) Subject: [tti] Consolidate getOperandInfo without OperandValueProperties copies [nfc] X-Git-Tag: upstream/17.0.6~35934 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b0a2c48e9f29bd49a8315dca10248cc3c1df5b7f;p=platform%2Fupstream%2Fllvm.git [tti] Consolidate getOperandInfo without OperandValueProperties copies [nfc] --- diff --git a/llvm/include/llvm/Analysis/TargetTransformInfo.h b/llvm/include/llvm/Analysis/TargetTransformInfo.h index ab9b701..1eb4164 100644 --- a/llvm/include/llvm/Analysis/TargetTransformInfo.h +++ b/llvm/include/llvm/Analysis/TargetTransformInfo.h @@ -1032,6 +1032,8 @@ public: /// 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. diff --git a/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h b/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h index a11e540..42282a7 100644 --- a/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h +++ b/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h @@ -1100,8 +1100,7 @@ public: case Instruction::Store: { auto *SI = cast(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); diff --git a/llvm/lib/Analysis/TargetTransformInfo.cpp b/llvm/lib/Analysis/TargetTransformInfo.cpp index b0f8fde..bba09f7 100644 --- a/llvm/lib/Analysis/TargetTransformInfo.cpp +++ b/llvm/lib/Analysis/TargetTransformInfo.cpp @@ -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, diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp index 09139a8..39cd9ec 100644 --- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp +++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp @@ -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); } @@ -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); diff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp index 5af240b..f2a7233c 100644 --- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp +++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp @@ -6483,8 +6483,7 @@ InstructionCost BoUpSLP::getEntryCost(const TreeEntry *E, auto *SI = cast(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;