[llvm] aea6b9d - [Support] replace check with assert in known bits of mul calculation; NFC
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 1 10:41:16 PST 2021
Author: Sanjay Patel
Date: 2021-12-01T13:41:12-05:00
New Revision: aea6b9dceeb6b1f2a677e2e9010029f56f8282e7
URL: https://github.com/llvm/llvm-project/commit/aea6b9dceeb6b1f2a677e2e9010029f56f8282e7
DIFF: https://github.com/llvm/llvm-project/commit/aea6b9dceeb6b1f2a677e2e9010029f56f8282e7.diff
LOG: [Support] replace check with assert in known bits of mul calculation; NFC
Added:
Modified:
llvm/lib/Support/KnownBits.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Support/KnownBits.cpp b/llvm/lib/Support/KnownBits.cpp
index 90483817c3029..554e3248524c6 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
More information about the llvm-commits
mailing list