From: Benjamin Kramer Date: Mon, 28 Nov 2011 16:56:38 +0000 (+0000) Subject: Handle more cases in APInt::getLowBitsSet's fast path. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=39a2eb7dea034820eb4b93b2361ae307b0cee5f2;p=oota-llvm.git Handle more cases in APInt::getLowBitsSet's fast path. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@145249 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/ADT/APInt.h b/include/llvm/ADT/APInt.h index 707e0dbb6b9..78119bce2ac 100644 --- a/include/llvm/ADT/APInt.h +++ b/include/llvm/ADT/APInt.h @@ -497,8 +497,8 @@ public: if (loBitsSet == APINT_BITS_PER_WORD) return APInt(numBits, -1ULL); // For small values, return quickly. - if (numBits < APINT_BITS_PER_WORD) - return APInt(numBits, (1ULL << loBitsSet) - 1); + if (loBitsSet <= APINT_BITS_PER_WORD) + return APInt(numBits, -1ULL >> (APINT_BITS_PER_WORD - loBitsSet)); return getAllOnesValue(numBits).lshr(numBits - loBitsSet); }