[ConstantRange] Add assertion for KnownBits validity; NFC

Following the suggestion in D59475.

llvm-svn: 356346
This commit is contained in:
Nikita Popov 2019-03-17 21:25:32 +00:00
parent 322e2dbee1
commit 5e7b62de05
1 changed files with 2 additions and 0 deletions

View 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);