[llvm] 64eaffb - [APInt] Fix type limits warning (NFC)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 5 09:10:20 PDT 2021


Author: Nikita Popov
Date: 2021-10-05T18:10:12+02:00
New Revision: 64eaffb613d0cb7fa7542fa48281a2e617ad8ee9

URL: https://github.com/llvm/llvm-project/commit/64eaffb613d0cb7fa7542fa48281a2e617ad8ee9
DIFF: https://github.com/llvm/llvm-project/commit/64eaffb613d0cb7fa7542fa48281a2e617ad8ee9.diff

LOG: [APInt] Fix type limits warning (NFC)

Unsigned number is always >= 0.

Added: 
    

Modified: 
    llvm/lib/Support/APInt.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Support/APInt.cpp b/llvm/lib/Support/APInt.cpp
index 67ea57c8ee59..298dcf6cad7e 100644
--- a/llvm/lib/Support/APInt.cpp
+++ b/llvm/lib/Support/APInt.cpp
@@ -360,8 +360,7 @@ void APInt::flipBit(unsigned bitPosition) {
 
 void APInt::insertBits(const APInt &subBits, unsigned bitPosition) {
   unsigned subBitWidth = subBits.getBitWidth();
-  assert(subBitWidth >= 0 && (subBitWidth + bitPosition) <= BitWidth &&
-         "Illegal bit insertion");
+  assert((subBitWidth + bitPosition) <= BitWidth && "Illegal bit insertion");
 
   // inserting no bits is a noop.
   if (subBitWidth == 0)


        


More information about the llvm-commits mailing list