[llvm] [RISCV][TTI] Reduce cost of a build_vector pattern (PR #108419)

via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 12 10:55:16 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 ee40ffd1ee3a13f504cfca6bae5e65c868a5b762 29cccc6087db4a0026053eb51c400dace8075c87 --extensions h,cpp -- llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h
``````````

</details>

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

``````````diff
diff --git a/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp b/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
index 0342479ce8..0ef85f0267 100644
--- a/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
+++ b/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
@@ -618,10 +618,8 @@ InstructionCost RISCVTTIImpl::getShuffleCost(TTI::ShuffleKind Kind,
 
 static unsigned isM1OrSmaller(MVT VT) {
   RISCVII::VLMUL LMUL = RISCVTargetLowering::getLMUL(VT);
-  return (LMUL == RISCVII::VLMUL::LMUL_F8 ||
-          LMUL == RISCVII::VLMUL::LMUL_F4 ||
-          LMUL == RISCVII::VLMUL::LMUL_F2 ||
-          LMUL == RISCVII::VLMUL::LMUL_1);
+  return (LMUL == RISCVII::VLMUL::LMUL_F8 || LMUL == RISCVII::VLMUL::LMUL_F4 ||
+          LMUL == RISCVII::VLMUL::LMUL_F2 || LMUL == RISCVII::VLMUL::LMUL_1);
 }
 
 InstructionCost RISCVTTIImpl::getScalarizationOverhead(
@@ -634,9 +632,8 @@ InstructionCost RISCVTTIImpl::getScalarizationOverhead(
   // worse than one vslide1down.vx per element in the type.  We could
   // in theory do an explode_vector in the inverse manner, but our
   // lowering today does not have a first class node for this pattern.
-  InstructionCost Cost =
-      BaseT::getScalarizationOverhead(Ty, DemandedElts, Insert, Extract,
-                                      CostKind);
+  InstructionCost Cost = BaseT::getScalarizationOverhead(
+      Ty, DemandedElts, Insert, Extract, CostKind);
   std::pair<InstructionCost, MVT> LT = getTypeLegalizationCost(Ty);
   if (Insert && !Extract && LT.first.isValid() && LT.second.isVector() &&
       Ty->getScalarSizeInBits() != 1) {
@@ -652,7 +649,6 @@ InstructionCost RISCVTTIImpl::getScalarizationOverhead(
   return Cost;
 }
 
-
 InstructionCost
 RISCVTTIImpl::getMaskedMemoryOpCost(unsigned Opcode, Type *Src, Align Alignment,
                                     unsigned AddressSpace,

``````````

</details>


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


More information about the llvm-commits mailing list