[llvm] [KnownBits] Make `avg{Ceil,Floor}S` and `{s,u}{add,sub}_sat` optimal (PR #110329)

via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 27 14:22:18 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 22c8b1d853dfde925eb63c4907332c596048c631 d21b441bfaf1f8f69ad9572d05c34e1f13430a27 --extensions cpp -- llvm/lib/Support/KnownBits.cpp llvm/unittests/Support/KnownBitsTest.cpp
``````````

</details>

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

``````````diff
diff --git a/llvm/lib/Support/KnownBits.cpp b/llvm/lib/Support/KnownBits.cpp
index 89e4b108b8..0380c8fcca 100644
--- a/llvm/lib/Support/KnownBits.cpp
+++ b/llvm/lib/Support/KnownBits.cpp
@@ -803,12 +803,12 @@ static KnownBits avgCompute(KnownBits LHS, KnownBits RHS, bool IsCeil,
                            /*CarryOne*/ IsCeil);
     // Assuming no overflow (which is the case since we extend the addition when
     // taking the average):
-	// Neg + Neg -> Neg
-	// Neg + Pos -> Neg if the signbit doesn't overflow
+    // Neg + Neg -> Neg
+    // Neg + Pos -> Neg if the signbit doesn't overflow
     if (LHS.isNegative() && ResOf.isNonNegative())
       Res.makeNegative();
-	// Pos + Pos -> Pos
-	// Pos + Neg -> Pos if the signbit does overflow
+    // Pos + Pos -> Pos
+    // Pos + Neg -> Pos if the signbit does overflow
     else if (LHS.isNonNegative() && ResOf.isNegative())
       Res.makeNonNegative();
   }

``````````

</details>


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


More information about the llvm-commits mailing list