diff --git a/lib/Support/ConstantRange.cpp b/lib/Support/ConstantRange.cpp index 71796493301..1e2a6375c45 100644 --- a/lib/Support/ConstantRange.cpp +++ b/lib/Support/ConstantRange.cpp @@ -44,22 +44,20 @@ ConstantRange::ConstantRange(const APInt &L, const APInt &U) : Lower(L), Upper(U) { assert(L.getBitWidth() == U.getBitWidth() && "ConstantRange with unequal bit widths"); - uint32_t BitWidth = L.getBitWidth(); - assert((L != U || (L == APInt::getMaxValue(BitWidth) || - L == APInt::getMinValue(BitWidth))) && + assert((L != U || (L.isMaxValue() || L.isMinValue())) && "Lower == Upper, but they aren't min or max value!"); } /// isFullSet - Return true if this set contains all of the elements possible /// for this data-type bool ConstantRange::isFullSet() const { - return Lower == Upper && Lower == APInt::getMaxValue(getBitWidth()); + return Lower == Upper && Lower.isMaxValue(); } /// isEmptySet - Return true if this set contains no members. /// bool ConstantRange::isEmptySet() const { - return Lower == Upper && Lower == APInt::getMinValue(getBitWidth()); + return Lower == Upper && Lower.isMinValue(); } /// isWrappedSet - Return true if this set wraps around the top of the range, diff --git a/lib/Transforms/Scalar/PredicateSimplifier.cpp b/lib/Transforms/Scalar/PredicateSimplifier.cpp index 7eef9ac6911..289f9c96557 100644 --- a/lib/Transforms/Scalar/PredicateSimplifier.cpp +++ b/lib/Transforms/Scalar/PredicateSimplifier.cpp @@ -748,14 +748,13 @@ namespace { return ConstantRange(APInt::getSignedMinValue(W), CR.getSignedMax()); case ICmpInst::ICMP_ULE: { APInt UMax(CR.getUnsignedMax()); - if (UMax == APInt::getMaxValue(W)) + if (UMax.isMaxValue()) return ConstantRange(W); return ConstantRange(APInt::getMinValue(W), UMax + 1); } case ICmpInst::ICMP_SLE: { APInt SMax(CR.getSignedMax()); - if (SMax == APInt::getSignedMaxValue(W) || - SMax + 1 == APInt::getSignedMaxValue(W)) + if (SMax.isMaxSignedValue() || (SMax+1).isMaxSignedValue()) return ConstantRange(W); return ConstantRange(APInt::getSignedMinValue(W), SMax + 1); } @@ -766,13 +765,13 @@ namespace { APInt::getSignedMinValue(W)); case ICmpInst::ICMP_UGE: { APInt UMin(CR.getUnsignedMin()); - if (UMin == APInt::getMinValue(W)) + if (UMin.isMinValue()) return ConstantRange(W); return ConstantRange(UMin, APInt::getNullValue(W)); } case ICmpInst::ICMP_SGE: { APInt SMin(CR.getSignedMin()); - if (SMin == APInt::getSignedMinValue(W)) + if (SMin.isMinSignedValue()) return ConstantRange(W); return ConstantRange(SMin, APInt::getSignedMinValue(W)); }