From: Craig Topper Date: Sat, 22 Apr 2017 19:59:11 +0000 (+0000) Subject: [APInt] Remove unnecessary min with BitWidth from countTrailingOnesSlowCase. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e14494685b3875d686bd1c68e1e945798ae3f89a;p=llvm [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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301091 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Support/APInt.cpp b/lib/Support/APInt.cpp index 95b8345b9c6..9bb364af279 100644 --- a/lib/Support/APInt.cpp +++ b/lib/Support/APInt.cpp @@ -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 {