[llvm] [TTI] Add cover functions for costing build and explode vectors [nfc] (PR #85421)

via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 15 09:03:08 PDT 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff 33960c90258ed78b9b877b1a43e219d1cbc2efce 90ef5a77188af9b7d2ff922066a2868b78bfd937 -- llvm/include/llvm/Analysis/TargetTransformInfo.h llvm/lib/Transforms/Vectorize/LoopVectorize.cpp llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/llvm/include/llvm/Analysis/TargetTransformInfo.h b/llvm/include/llvm/Analysis/TargetTransformInfo.h
index 46ea102d00..6e5fa5c996 100644
--- a/llvm/include/llvm/Analysis/TargetTransformInfo.h
+++ b/llvm/include/llvm/Analysis/TargetTransformInfo.h
@@ -875,8 +875,7 @@ public:
   /// implied by the active lanes in DemandedElts.  The default implementation
   /// will simply cost a series of insertelements, but some targets can do
   /// significantly better.
-  InstructionCost getBuildVectorCost(VectorType *Ty,
-                                     const APInt &DemandedElts,
+  InstructionCost getBuildVectorCost(VectorType *Ty, const APInt &DemandedElts,
                                      TTI::TargetCostKind CostKind) const {
     return getScalarizationOverhead(Ty, DemandedElts, true, false, CostKind);
   }
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index d999606836..0d36690ab8 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -6383,9 +6383,9 @@ InstructionCost LoopVectorizationCostModel::getScalarizationOverhead(
   Type *RetTy = ToVectorTy(I->getType(), VF);
   if (!RetTy->isVoidTy() &&
       (!isa<LoadInst>(I) || !TTI.supportsEfficientVectorElementLoadStore()))
-    Cost += TTI.getBuildVectorCost(
-        cast<VectorType>(RetTy), APInt::getAllOnes(VF.getKnownMinValue()),
-        CostKind);
+    Cost += TTI.getBuildVectorCost(cast<VectorType>(RetTy),
+                                   APInt::getAllOnes(VF.getKnownMinValue()),
+                                   CostKind);
 
   // Some targets keep addresses scalar.
   if (isa<LoadInst>(I) && !TTI.prefersVectorizedAddressing())

``````````

</details>


https://github.com/llvm/llvm-project/pull/85421


More information about the llvm-commits mailing list