@@ -1772,46 +1772,45 @@ ConstantRange ConstantRange::cttz(bool ZeroIsPoison) const {
1772
1772
if (isEmptySet ())
1773
1773
return getEmpty ();
1774
1774
1775
- APInt Zero = APInt::getZero ( getBitWidth () );
1776
-
1775
+ unsigned BitWidth = getBitWidth ();
1776
+ APInt Zero = APInt::getZero (BitWidth);
1777
1777
if (ZeroIsPoison && contains (Zero)) {
1778
1778
// ZeroIsPoison is set, and zero is contained. We discern three cases, in
1779
1779
// which a zero can appear:
1780
1780
// 1) Lower is zero, handling cases of kind [0, 1), [0, 2), etc.
1781
1781
// 2) Upper is zero, wrapped set, handling cases of kind [3, 0], etc.
1782
1782
// 3) Zero contained in a wrapped set, e.g., [3, 2), [3, 1), etc.
1783
1783
1784
- if (getLower () .isZero ()) {
1785
- if (getUpper () == 1 ) {
1784
+ if (Lower .isZero ()) {
1785
+ if (Upper == 1 ) {
1786
1786
// We have in input interval of kind [0, 1). In this case we cannot
1787
1787
// really help but return empty-set.
1788
1788
return getEmpty ();
1789
1789
}
1790
1790
1791
1791
// Compute the resulting range by excluding zero from Lower.
1792
- return getUnsignedCountTrailingZerosRange (APInt (getBitWidth (), 1 ),
1793
- getUpper ());
1794
- } else if (getUpper () == 1 ) {
1792
+ return getUnsignedCountTrailingZerosRange (APInt (BitWidth, 1 ), Upper);
1793
+ } else if (Upper == 1 ) {
1795
1794
// Compute the resulting range by excluding zero from Upper.
1796
- return getUnsignedCountTrailingZerosRange (getLower () , Zero);
1795
+ return getUnsignedCountTrailingZerosRange (Lower , Zero);
1797
1796
} else {
1798
- ConstantRange CR1 = getUnsignedCountTrailingZerosRange (getLower () , Zero);
1799
- ConstantRange CR2 = getUnsignedCountTrailingZerosRange (
1800
- APInt (getBitWidth () , 1 ), getUpper () );
1797
+ ConstantRange CR1 = getUnsignedCountTrailingZerosRange (Lower , Zero);
1798
+ ConstantRange CR2 =
1799
+ getUnsignedCountTrailingZerosRange ( APInt (BitWidth , 1 ), Upper );
1801
1800
return CR1.unionWith (CR2);
1802
1801
}
1803
1802
}
1804
1803
1805
1804
if (isFullSet ())
1806
- return getNonEmpty (Zero, APInt (getBitWidth (), getBitWidth () + 1 ));
1805
+ return getNonEmpty (Zero, APInt (BitWidth, BitWidth + 1 ));
1807
1806
if (!isWrappedSet ())
1808
- return getUnsignedCountTrailingZerosRange (getLower (), getUpper () );
1807
+ return getUnsignedCountTrailingZerosRange (Lower, Upper );
1809
1808
// The range is wrapped. We decompose it into two ranges, [0, Upper) and
1810
1809
// [Lower, 0).
1811
1810
// Handle [Lower, 0)
1812
- ConstantRange CR1 = getUnsignedCountTrailingZerosRange (getLower () , Zero);
1811
+ ConstantRange CR1 = getUnsignedCountTrailingZerosRange (Lower , Zero);
1813
1812
// Handle [0, Upper)
1814
- ConstantRange CR2 = getUnsignedCountTrailingZerosRange (Zero, getUpper () );
1813
+ ConstantRange CR2 = getUnsignedCountTrailingZerosRange (Zero, Upper );
1815
1814
return CR1.unionWith (CR2);
1816
1815
}
1817
1816
0 commit comments