[llvm] [VPlan] Simplify (X && Y) || (X && !Y) -> X. (PR #89386)

via llvm-commits llvm-commits at lists.llvm.org
Thu May 9 08:52:21 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 e2d17a053edff68c9761aceb8ff8303e3e37172c 4419476b3fba4db88db17de15ce046c0c4b661a2 -- llvm/lib/Transforms/Vectorize/VPlanPatternMatch.h llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
``````````

</details>

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

``````````diff
diff --git a/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp b/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
index 246c31b79e..91d2ae640b 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
@@ -940,10 +940,12 @@ static void simplifyRecipe(VPRecipeBase &R, VPTypeAnalysis &TypeInfo) {
   VPValue *X1;
   VPValue *Y1;
   // Simplify (X && Y) || (X1 && !Y1) -> X.
-  // TODO: Split up into simpler, modular combines: (X && Y) || (X && Z) into X && (Y || Z) and (X || !X) into true. This requires queuing newly created recipes to be visited during simplification.
-  if (match(&R,
-            m_c_LogicalOr(m_c_LogicalAnd(m_VPValue(X), m_VPValue(Y)),
-                          m_c_LogicalAnd(m_VPValue(X1), m_Not(m_VPValue(Y1))))) &&
+  // TODO: Split up into simpler, modular combines: (X && Y) || (X && Z) into X
+  // && (Y || Z) and (X || !X) into true. This requires queuing newly created
+  // recipes to be visited during simplification.
+  if (match(&R, m_c_LogicalOr(
+                    m_c_LogicalAnd(m_VPValue(X), m_VPValue(Y)),
+                    m_c_LogicalAnd(m_VPValue(X1), m_Not(m_VPValue(Y1))))) &&
       X == X1 && Y == Y1) {
     R.getVPSingleValue()->replaceAllUsesWith(X);
     return;

``````````

</details>


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


More information about the llvm-commits mailing list