[tti] Consolidate getOperandInfo without OperandValueProperties copies [nfc]
authorPhilip Reames <preames@rivosinc.com>
Fri, 19 Aug 2022 23:21:14 +0000 (16:21 -0700)
committerPhilip Reames <listmail@philipreames.com>
Fri, 19 Aug 2022 23:22:22 +0000 (16:22 -0700)
llvm/include/llvm/Analysis/TargetTransformInfo.h
llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
llvm/lib/Analysis/TargetTransformInfo.cpp
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp

index ab9b701..1eb4164 100644 (file)
@@ -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.
index a11e540..42282a7 100644 (file)
@@ -1100,8 +1100,7 @@ public:
     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);
index b0f8fde..bba09f7 100644 (file)
@@ -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,
index 09139a8..39cd9ec 100644 (file)
@@ -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);
index 5af240b..f2a7233 100644 (file)
@@ -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;