[ConstantRange] Add assertion for KnownBits validity; NFC
authorNikita Popov <nikita.ppv@gmail.com>
Sun, 17 Mar 2019 21:25:32 +0000 (21:25 +0000)
committerNikita Popov <nikita.ppv@gmail.com>
Sun, 17 Mar 2019 21:25:32 +0000 (21:25 +0000)
Following the suggestion in D59475.

llvm-svn: 356346

llvm/lib/IR/ConstantRange.cpp

index d41914b..16def8b 100644 (file)
@@ -56,6 +56,8 @@ ConstantRange::ConstantRange(APInt L, APInt U)
 
 ConstantRange ConstantRange::fromKnownBits(const KnownBits &Known,
                                            bool IsSigned) {
+  assert(!Known.hasConflict() && "Expected valid KnownBits");
+
   if (Known.isUnknown())
     return ConstantRange(Known.getBitWidth(), /* full */ true);