From aea6b9dceeb6b1f2a677e2e9010029f56f8282e7 Mon Sep 17 00:00:00 2001 From: Sanjay Patel Date: Wed, 1 Dec 2021 13:39:48 -0500 Subject: [PATCH] [Support] replace check with assert in known bits of mul calculation; NFC --- llvm/lib/Support/KnownBits.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/llvm/lib/Support/KnownBits.cpp b/llvm/lib/Support/KnownBits.cpp index 9048381..554e324 100644 --- a/llvm/lib/Support/KnownBits.cpp +++ b/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 -- 2.7.4