From 1135cfa6a7f690aaf42079f020e32e502610e92b Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Sun, 17 Mar 2019 21:25:32 +0000 Subject: [PATCH] [ConstantRange] Add assertion for KnownBits validity; NFC Following the suggestion in D59475. llvm-svn: 356346 --- lib/IR/ConstantRange.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/IR/ConstantRange.cpp b/lib/IR/ConstantRange.cpp index d41914ba4a9..16def8bc5e8 100644 --- a/lib/IR/ConstantRange.cpp +++ b/lib/IR/ConstantRange.cpp @@ -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);