[llvm] [InstCombine] Add additional known bits info for self multiply (PR #151202)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 8 07:09:31 PDT 2025


================
@@ -888,11 +888,20 @@ KnownBits KnownBits::mul(const KnownBits &LHS, const KnownBits &RHS,
   Res.Zero |= (~BottomKnown).getLoBits(ResultBitsKnown);
   Res.One = BottomKnown.getLoBits(ResultBitsKnown);
 
-  // If we're self-multiplying then bit[1] is guaranteed to be zero.
-  if (NoUndefSelfMultiply && BitWidth > 1) {
-    assert(Res.One[1] == 0 &&
-           "Self-multiplication failed Quadratic Reciprocity!");
-    Res.Zero.setBit(1);
+  // Self multiplying
----------------
nikic wrote:

```suggestion
```

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


More information about the llvm-commits mailing list