[llvm] Expanding the Histogram Intrinsic (PR #127399)

via llvm-commits llvm-commits at lists.llvm.org
Sun Feb 16 06:53:12 PST 2025


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 17d508f30d897e7392e48885850c9595546e342c 12934d999b6f9020a6e1810824df7eaf1b1b5cc3 --extensions h,cpp -- llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp llvm/lib/Transforms/Vectorize/LoopVectorize.cpp llvm/lib/Transforms/Vectorize/VPlan.h llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
``````````

</details>

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

``````````diff
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp
index bfa1cdfd9c..f2070364c0 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp
@@ -1107,13 +1107,13 @@ static bool findHistogram(LoadInst *LI, StoreInst *HSt, Loop *TheLoop,
   //        Fine for an immediate/constant, but maybe not a generic value?
   Value *HIncVal = nullptr;
   if (!match(HInstr, m_Add(m_Load(m_Specific(HPtrInstr)), m_Value(HIncVal))) &&
-         !match(HInstr, m_Sub(m_Load(m_Specific(HPtrInstr)), m_Value(HIncVal))) &&
-         !match(HInstr, m_Intrinsic<Intrinsic::uadd_sat>(
-                           m_Load(m_Specific(HPtrInstr)), m_Value(HIncVal))) &&
-         !match(HInstr, m_Intrinsic<Intrinsic::umax>(
-                           m_Load(m_Specific(HPtrInstr)), m_Value(HIncVal))) &&
-         !match(HInstr, m_Intrinsic<Intrinsic::umin>(
-                           m_Load(m_Specific(HPtrInstr)), m_Value(HIncVal))))
+      !match(HInstr, m_Sub(m_Load(m_Specific(HPtrInstr)), m_Value(HIncVal))) &&
+      !match(HInstr, m_Intrinsic<Intrinsic::uadd_sat>(
+                         m_Load(m_Specific(HPtrInstr)), m_Value(HIncVal))) &&
+      !match(HInstr, m_Intrinsic<Intrinsic::umax>(m_Load(m_Specific(HPtrInstr)),
+                                                  m_Value(HIncVal))) &&
+      !match(HInstr, m_Intrinsic<Intrinsic::umin>(m_Load(m_Specific(HPtrInstr)),
+                                                  m_Value(HIncVal))))
     return false;
 
   // Make sure the increment value is loop invariant.
diff --git a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
index 95eb337cbb..5bab333ded 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
@@ -1335,7 +1335,8 @@ bool VPHistogramRecipe::isLegalUpdateInstruction(Instruction *I) {
   // We only support add and sub instructions and the following list of
   // intrinsics: uadd.sat, umax, umin.
   if (isa<BinaryOperator>(I))
-    return I->getOpcode() == Instruction::Add || I->getOpcode() == Instruction::Sub;
+    return I->getOpcode() == Instruction::Add ||
+           I->getOpcode() == Instruction::Sub;
   if (auto *II = dyn_cast<IntrinsicInst>(I)) {
     switch (II->getIntrinsicID()) {
     case Intrinsic::uadd_sat:
@@ -1359,7 +1360,8 @@ unsigned VPHistogramRecipe::getHistogramOpcode(Instruction *I) {
   auto *II = cast<IntrinsicInst>(I);
   switch (II->getIntrinsicID()) {
   case Intrinsic::uadd_sat:
-    return Intrinsic::experimental_vector_histogram_uadd_sat;;
+    return Intrinsic::experimental_vector_histogram_uadd_sat;
+    ;
   case Intrinsic::umax:
     return Intrinsic::experimental_vector_histogram_umax;
   case Intrinsic::umin:

``````````

</details>


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


More information about the llvm-commits mailing list