[llvm] [TargetLowering] Change subtraction to do (LHS < RHS) XOR (RESULT < 0) (PR #150872)

via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 27 21:38:27 PDT 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 HEAD~1 HEAD --extensions cpp -- llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
``````````

</details>

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

``````````diff
diff --git a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
index cbd42251b..f6bb85f4b 100644
--- a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
@@ -11447,12 +11447,13 @@ void TargetLowering::expandSADDSUBO(
   // For a subtraction, the result should be less than one of the operands
   // (LHS) if and only if the other operand (RHS) is (non-zero) positive,
   // otherwise there will be overflow.
-  
+
   if (IsAdd) {
     // For addition, the result should be less than one of the operands (LHS)
     // if and only if the other operand (RHS) is negative, otherwise there will
     // be overflow.
-    SDValue ResultLowerThanLHS = DAG.getSetCC(dl, OType, Result, LHS, ISD::SETLT);
+    SDValue ResultLowerThanLHS =
+        DAG.getSetCC(dl, OType, Result, LHS, ISD::SETLT);
     SDValue ConditionRHS = DAG.getSetCC(dl, OType, RHS, Zero, ISD::SETLT);
     Overflow = DAG.getBoolExtOrTrunc(
         DAG.getNode(ISD::XOR, dl, OType, ConditionRHS, ResultLowerThanLHS), dl,

``````````

</details>


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


More information about the llvm-commits mailing list