diff --git a/include/llvm/ADT/APInt.h b/include/llvm/ADT/APInt.h index b524b56e9b4..8f3b2f6a6d4 100644 --- a/include/llvm/ADT/APInt.h +++ b/include/llvm/ADT/APInt.h @@ -355,6 +355,7 @@ public: /// @brief Get a value with high bits set static APInt getHighBitsSet(uint32_t numBits, uint32_t hiBitsSet) { assert(hiBitsSet <= numBits && "Too many bits to set!"); + assert(hiBitsSet > 0 && "You must set SOME bits"); uint32_t shiftAmt = numBits - hiBitsSet; // For small values, return quickly if (numBits <= APINT_BITS_PER_WORD) @@ -368,6 +369,7 @@ public: /// @brief Get a value with low bits set static APInt getLowBitsSet(uint32_t numBits, uint32_t loBitsSet) { assert(loBitsSet <= numBits && "Too many bits to set!"); + assert(loBitsSet > 0 && "You must set SOME bits"); uint32_t shiftAmt = numBits - loBitsSet; // For small values, return quickly if (numBits <= APINT_BITS_PER_WORD)