[llvm] [InstCombine] Add additional known bits info for self multiply (PR #151202)
Yingwei Zheng via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 4 10:47:45 PDT 2025
================
@@ -888,11 +888,27 @@ 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
+ if (NoUndefSelfMultiply) {
+ // bit[1] is guaranteed to be zero.
+ if (BitWidth > 1) {
+ assert(Res.One[1] == 0 &&
+ "Self-multiplication failed Quadratic Reciprocity!");
+ Res.Zero.setBit(1);
+ }
----------------
dtcxzyw wrote:
```suggestion
```
It is covered by the logic below.
https://github.com/llvm/llvm-project/pull/151202
More information about the llvm-commits
mailing list