diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2021-12-02 21:49:08 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2022-06-04 11:59:04 +0000 |
| commit | 574b7079b96703a748f89ef5adb7dc3e26b8f7fc (patch) | |
| tree | 195000196b1e0cc13dea43258fa240e006f48184 /contrib/llvm-project/llvm/lib/Support/KnownBits.cpp | |
| parent | 1f6fd64fe9c996b4795ee4a6c66b8f9216747560 (diff) | |
Diffstat (limited to 'contrib/llvm-project/llvm/lib/Support/KnownBits.cpp')
| -rw-r--r-- | contrib/llvm-project/llvm/lib/Support/KnownBits.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/contrib/llvm-project/llvm/lib/Support/KnownBits.cpp b/contrib/llvm-project/llvm/lib/Support/KnownBits.cpp index 90483817c302..554e3248524c 100644 --- a/contrib/llvm-project/llvm/lib/Support/KnownBits.cpp +++ b/contrib/llvm-project/llvm/lib/Support/KnownBits.cpp @@ -421,11 +421,10 @@ KnownBits KnownBits::mul(const KnownBits &LHS, const KnownBits &RHS, "Self multiplication knownbits mismatch"); // Compute a conservative estimate for high known-0 bits. - unsigned LeadZ = - std::max(LHS.countMinLeadingZeros() + RHS.countMinLeadingZeros(), - BitWidth) - - BitWidth; - LeadZ = std::min(LeadZ, BitWidth); + unsigned LHSLeadZ = LHS.countMinLeadingZeros(); + unsigned RHSLeadZ = RHS.countMinLeadingZeros(); + unsigned LeadZ = std::max(LHSLeadZ + RHSLeadZ, BitWidth) - BitWidth; + assert(LeadZ <= BitWidth && "More zeros than bits?"); // The result of the bottom bits of an integer multiply can be // inferred by looking at the bottom bits of both operands and |
