]> granicus.if.org Git - llvm/commitdiff
[APInt] Remove unnecessary min with BitWidth from countTrailingOnesSlowCase.
authorCraig Topper <craig.topper@gmail.com>
Sat, 22 Apr 2017 19:59:11 +0000 (19:59 +0000)
committerCraig Topper <craig.topper@gmail.com>
Sat, 22 Apr 2017 19:59:11 +0000 (19:59 +0000)
The unused upper bits are guaranteed to be 0 so we don't need to worry about accidentally counting them.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301091 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Support/APInt.cpp

index 95b8345b9c6480b1e2987cac7d349f08ab951e5a..9bb364af27918193f15ba5d9935bafe6891fbf2f 100644 (file)
@@ -688,7 +688,8 @@ unsigned APInt::countTrailingOnesSlowCase() const {
     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 {