[llvm] 9e72d3e - [ValueTracking] Use KnownBits::countMaxLeadingZeros/countMaxTrailingZeros to make code more readable. NFC
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Sun Oct 11 14:27:06 PDT 2020
Author: Craig Topper
Date: 2020-10-11T14:26:18-07:00
New Revision: 9e72d3eaf38f217698f72cb8fdc969a6e72dad3a
URL: https://github.com/llvm/llvm-project/commit/9e72d3eaf38f217698f72cb8fdc969a6e72dad3a
DIFF: https://github.com/llvm/llvm-project/commit/9e72d3eaf38f217698f72cb8fdc969a6e72dad3a.diff
LOG: [ValueTracking] Use KnownBits::countMaxLeadingZeros/countMaxTrailingZeros to make code more readable. NFC
Added:
Modified:
llvm/lib/Analysis/ValueTracking.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp
index f84531fee2fa..979d25b554a9 100644
--- a/llvm/lib/Analysis/ValueTracking.cpp
+++ b/llvm/lib/Analysis/ValueTracking.cpp
@@ -1585,7 +1585,7 @@ static void computeKnownBitsFromOperator(const Operator *I,
case Intrinsic::ctlz: {
computeKnownBits(I->getOperand(0), Known2, Depth + 1, Q);
// If we have a known 1, its position is our upper bound.
- unsigned PossibleLZ = Known2.One.countLeadingZeros();
+ unsigned PossibleLZ = Known2.countMaxLeadingZeros();
// If this call is undefined for 0, the result will be less than 2^n.
if (II->getArgOperand(1) == ConstantInt::getTrue(II->getContext()))
PossibleLZ = std::min(PossibleLZ, BitWidth - 1);
@@ -1596,7 +1596,7 @@ static void computeKnownBitsFromOperator(const Operator *I,
case Intrinsic::cttz: {
computeKnownBits(I->getOperand(0), Known2, Depth + 1, Q);
// If we have a known 1, its position is our upper bound.
- unsigned PossibleTZ = Known2.One.countTrailingZeros();
+ unsigned PossibleTZ = Known2.countMaxTrailingZeros();
// If this call is undefined for 0, the result will be less than 2^n.
if (II->getArgOperand(1) == ConstantInt::getTrue(II->getContext()))
PossibleTZ = std::min(PossibleTZ, BitWidth - 1);
More information about the llvm-commits
mailing list