[llvm] r301091 - [APInt] Remove unnecessary min with BitWidth from countTrailingOnesSlowCase.
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Sat Apr 22 12:59:11 PDT 2017
Author: ctopper
Date: Sat Apr 22 14:59:11 2017
New Revision: 301091
URL: http://llvm.org/viewvc/llvm-project?rev=301091&view=rev
Log:
[APInt] Remove unnecessary min with BitWidth from countTrailingOnesSlowCase.
The unused upper bits are guaranteed to be 0 so we don't need to worry about accidentally counting them.
Modified:
llvm/trunk/lib/Support/APInt.cpp
Modified: llvm/trunk/lib/Support/APInt.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/APInt.cpp?rev=301091&r1=301090&r2=301091&view=diff
==============================================================================
--- llvm/trunk/lib/Support/APInt.cpp (original)
+++ llvm/trunk/lib/Support/APInt.cpp Sat Apr 22 14:59:11 2017
@@ -688,7 +688,8 @@ unsigned APInt::countTrailingOnesSlowCas
Count += APINT_BITS_PER_WORD;
if (i < getNumWords())
Count += llvm::countTrailingOnes(pVal[i]);
- return std::min(Count, BitWidth);
+ assert(Count <= BitWidth);
+ return Count;
}
unsigned APInt::countPopulationSlowCase() const {
More information about the llvm-commits
mailing list