[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.

llvm-svn: 301091

llvm/lib/Support/APInt.cpp

index 95b8345..9bb364a 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 {