forked from OSchip/llvm-project
[ConstantRange] Fix a couple cases where we were possibly throwing away an APInt allocation we could reuse. NFC
This uses setAllBits to replace getMaxValue and operator=(uint64_t) instead of constructing an APInt from uint64_t. llvm-svn: 301761
This commit is contained in:
parent
c12f10fe19
commit
866165309f
|
@ -581,7 +581,7 @@ ConstantRange ConstantRange::truncate(uint32_t DstTySize) const {
|
||||||
return ConstantRange(DstTySize, /*isFullSet=*/true);
|
return ConstantRange(DstTySize, /*isFullSet=*/true);
|
||||||
|
|
||||||
Union = ConstantRange(APInt::getMaxValue(DstTySize),Upper.trunc(DstTySize));
|
Union = ConstantRange(APInt::getMaxValue(DstTySize),Upper.trunc(DstTySize));
|
||||||
UpperDiv = APInt::getMaxValue(getBitWidth());
|
UpperDiv.setAllBits();
|
||||||
|
|
||||||
// Union covers the MaxValue case, so return if the remaining range is just
|
// Union covers the MaxValue case, so return if the remaining range is just
|
||||||
// MaxValue.
|
// MaxValue.
|
||||||
|
@ -837,7 +837,7 @@ ConstantRange::udiv(const ConstantRange &RHS) const {
|
||||||
if (RHS.getUpper() == 1)
|
if (RHS.getUpper() == 1)
|
||||||
RHS_umin = RHS.getLower();
|
RHS_umin = RHS.getLower();
|
||||||
else
|
else
|
||||||
RHS_umin = APInt(getBitWidth(), 1);
|
RHS_umin = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
APInt Upper = getUnsignedMax().udiv(RHS_umin) + 1;
|
APInt Upper = getUnsignedMax().udiv(RHS_umin) + 1;
|
||||||
|
|
Loading…
Reference in New Issue