[llvm] [InstCombine] Fold out-of-range bits for squaring signed integers (PR #153484)

via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 19 10:46:17 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/Analysis/ValueTracking.cpp
``````````

</details>

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

``````````diff
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp
index 1476368cc..5046d1cce 100644
--- a/llvm/lib/Analysis/ValueTracking.cpp
+++ b/llvm/lib/Analysis/ValueTracking.cpp
@@ -431,8 +431,9 @@ static void computeKnownBitsMul(const Value *Op0, const Value *Op1, bool NSW,
     unsigned TyBits = Op0->getType()->getScalarSizeInBits();
     // The output of the Mul can be at most twice the valid bits
     unsigned OutValidBits = 2 * (TyBits - SignBits + 1);
-    unsigned OutSignBits = OutValidBits > TyBits ? 1 : TyBits - OutValidBits + 1;
-    
+    unsigned OutSignBits =
+        OutValidBits > TyBits ? 1 : TyBits - OutValidBits + 1;
+
     if (OutSignBits > 1) {
       APInt KnownZeroMask = APInt::getHighBitsSet(TyBits, OutSignBits);
       llvm::outs() << "KnownZeroMask = " << KnownZeroMask << "\n";

``````````

</details>


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


More information about the llvm-commits mailing list