[llvm] select m, sub/add(X, C), X --> sub/add (X, and(C, m)) (PR #82441)

via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 20 15:49:46 PST 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 2646dccaa35e9bf414cb5c77d047ab1733054018 49213f9360afe63a272165d738883cf3f8fe1c67 -- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
``````````

</details>

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

``````````diff
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index 42b24efc81..9608bf466d 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -11664,18 +11664,18 @@ SDValue DAGCombiner::visitSELECT(SDNode *N) {
   if (N1.getOpcode() == ISD::SUB && N1.getOperand(0) == N2 && N1->hasOneUse() &&
       DAG.isConstantIntBuildVectorOrConstantInt(N1.getOperand(1)) &&
       N0.getScalarValueSizeInBits() == N1.getScalarValueSizeInBits()) {
-    return DAG.getNode(ISD::SUB, DL, N1.getValueType(), N2,
-                       DAG.getNode(ISD::AND, DL, N0.getValueType(), N1.getOperand(1),
-                                   N0));
+    return DAG.getNode(
+        ISD::SUB, DL, N1.getValueType(), N2,
+        DAG.getNode(ISD::AND, DL, N0.getValueType(), N1.getOperand(1), N0));
   }
 
   // select (sext m), (add X, C), X --> (add X, (and C, (sext m))))
   if (N1.getOpcode() == ISD::ADD && N1.getOperand(0) == N2 && N1->hasOneUse() &&
-      DAG.isConstantIntBuildVectorOrConstantInt(N1.getOperand(1)) && 
+      DAG.isConstantIntBuildVectorOrConstantInt(N1.getOperand(1)) &&
       N0.getScalarValueSizeInBits() == N1.getScalarValueSizeInBits()) {
-    return DAG.getNode(ISD::ADD, DL, N1.getValueType(), N2,
-                       DAG.getNode(ISD::AND, DL, N0.getValueType(), N1.getOperand(1),
-                                   N0));
+    return DAG.getNode(
+        ISD::ADD, DL, N1.getValueType(), N2,
+        DAG.getNode(ISD::AND, DL, N0.getValueType(), N1.getOperand(1), N0));
   }
 
   // Fold selects based on a setcc into other things, such as min/max/abs.

``````````

</details>


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


More information about the llvm-commits mailing list