[llvm] 53e9eee - [X86][TTI] Use TargetCostConstants Free/Basic values instead of hard coded 0/1 to make the costs calculation more obvious. NFC.

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 10 02:51:23 PST 2024


Author: Simon Pilgrim
Date: 2024-12-10T10:51:06Z
New Revision: 53e9eee0e2c9587fc7a1e7b5f64ba2a935f58e0a

URL: https://github.com/llvm/llvm-project/commit/53e9eee0e2c9587fc7a1e7b5f64ba2a935f58e0a
DIFF: https://github.com/llvm/llvm-project/commit/53e9eee0e2c9587fc7a1e7b5f64ba2a935f58e0a.diff

LOG: [X86][TTI] Use TargetCostConstants Free/Basic values instead of hard coded 0/1 to make the costs calculation more obvious. NFC.

Added: 
    

Modified: 
    llvm/lib/Target/X86/X86TargetTransformInfo.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/X86/X86TargetTransformInfo.cpp b/llvm/lib/Target/X86/X86TargetTransformInfo.cpp
index cae72c4210352e..ceb358776b2ace 100644
--- a/llvm/lib/Target/X86/X86TargetTransformInfo.cpp
+++ b/llvm/lib/Target/X86/X86TargetTransformInfo.cpp
@@ -1584,7 +1584,7 @@ InstructionCost X86TTIImpl::getShuffleCost(
   if (Kind == TTI::SK_ExtractSubvector && LT.second.isVector()) {
     int NumElts = LT.second.getVectorNumElements();
     if ((Index % NumElts) == 0)
-      return 0;
+      return TTI::TCC_Free;
     std::pair<InstructionCost, MVT> SubLT = getTypeLegalizationCost(SubTp);
     if (SubLT.second.isVector()) {
       int NumSubElts = SubLT.second.getVectorNumElements();
@@ -4763,7 +4763,7 @@ InstructionCost X86TTIImpl::getVectorInstrCost(unsigned Opcode, Type *Val,
 
     // This type is legalized to a scalar type.
     if (!LT.second.isVector())
-      return 0;
+      return TTI::TCC_Free;
 
     // The type may be split. Normalize the index to the new type.
     unsigned SizeInBits = LT.second.getSizeInBits();
@@ -6030,9 +6030,9 @@ InstructionCost X86TTIImpl::getCFInstrCost(unsigned Opcode,
                                            TTI::TargetCostKind CostKind,
                                            const Instruction *I) {
   if (CostKind != TTI::TCK_RecipThroughput)
-    return Opcode == Instruction::PHI ? 0 : 1;
+    return Opcode == Instruction::PHI ? TTI::TCC_Free : TTI::TCC_Basic;
   // Branches are assumed to be predicted.
-  return 0;
+  return TTI::TCC_Free;
 }
 
 int X86TTIImpl::getGatherOverhead() const {


        


More information about the llvm-commits mailing list