aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm-project/llvm/lib/Support/KnownBits.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm-project/llvm/lib/Support/KnownBits.cpp')
-rw-r--r--contrib/llvm-project/llvm/lib/Support/KnownBits.cpp9
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