APInt UMax(CR.getUnsignedMax());
if (UMax.isMinValue())
return ConstantRange(W, /* empty */ false);
- return ConstantRange(APInt::getMinValue(W), UMax);
+ return ConstantRange(APInt::getMinValue(W), std::move(UMax));
}
case CmpInst::ICMP_SLT: {
APInt SMax(CR.getSignedMax());
if (SMax.isMinSignedValue())
return ConstantRange(W, /* empty */ false);
- return ConstantRange(APInt::getSignedMinValue(W), SMax);
+ return ConstantRange(APInt::getSignedMinValue(W), std::move(SMax));
}
case CmpInst::ICMP_ULE: {
APInt UMax(CR.getUnsignedMax());
if (UMax.isMaxValue())
return ConstantRange(W);
- return ConstantRange(APInt::getMinValue(W), UMax + 1);
+ return ConstantRange(APInt::getMinValue(W), std::move(UMax) + 1);
}
case CmpInst::ICMP_SLE: {
APInt SMax(CR.getSignedMax());
if (SMax.isMaxSignedValue())
return ConstantRange(W);
- return ConstantRange(APInt::getSignedMinValue(W), SMax + 1);
+ return ConstantRange(APInt::getSignedMinValue(W), std::move(SMax) + 1);
}
case CmpInst::ICMP_UGT: {
APInt UMin(CR.getUnsignedMin());
if (UMin.isMaxValue())
return ConstantRange(W, /* empty */ false);
- return ConstantRange(UMin + 1, APInt::getNullValue(W));
+ return ConstantRange(std::move(UMin) + 1, APInt::getNullValue(W));
}
case CmpInst::ICMP_SGT: {
APInt SMin(CR.getSignedMin());
if (SMin.isMaxSignedValue())
return ConstantRange(W, /* empty */ false);
- return ConstantRange(SMin + 1, APInt::getSignedMinValue(W));
+ return ConstantRange(std::move(SMin) + 1, APInt::getSignedMinValue(W));
}
case CmpInst::ICMP_UGE: {
APInt UMin(CR.getUnsignedMin());
if (UMin.isMinValue())
return ConstantRange(W);
- return ConstantRange(UMin, APInt::getNullValue(W));
+ return ConstantRange(std::move(UMin), APInt::getNullValue(W));
}
case CmpInst::ICMP_SGE: {
APInt SMin(CR.getSignedMin());
if (SMin.isMinSignedValue())
return ConstantRange(W);
- return ConstantRange(SMin, APInt::getSignedMinValue(W));
+ return ConstantRange(std::move(SMin), APInt::getSignedMinValue(W));
}
}
}
if (L == 0 && U == 0)
return ConstantRange(getBitWidth());
- return ConstantRange(L, U);
+ return ConstantRange(std::move(L), std::move(U));
}
if (!CR.isWrappedSet()) {
if (CR.Lower.ult(L))
L = CR.Lower;
- return ConstantRange(L, U);
+ return ConstantRange(std::move(L), std::move(U));
}
ConstantRange ConstantRange::castOp(Instruction::CastOps CastOp,
auto BW = getBitWidth();
APInt Min = APInt::getMinValue(BW).zextOrSelf(ResultBitWidth);
APInt Max = APInt::getMaxValue(BW).zextOrSelf(ResultBitWidth);
- return ConstantRange(Min, Max);
+ return ConstantRange(std::move(Min), std::move(Max));
}
case Instruction::SIToFP: {
// TODO: use input range if available
auto BW = getBitWidth();
APInt SMin = APInt::getSignedMinValue(BW).sextOrSelf(ResultBitWidth);
APInt SMax = APInt::getSignedMaxValue(BW).sextOrSelf(ResultBitWidth);
- return ConstantRange(SMin, SMax);
+ return ConstantRange(std::move(SMin), std::move(SMax));
}
case Instruction::FPTrunc:
case Instruction::FPExt:
APInt LowerExt(DstTySize, 0);
if (!Upper) // special case: [X, 0) -- not really wrapping around
LowerExt = Lower.zext(DstTySize);
- return ConstantRange(LowerExt, APInt::getOneBitSet(DstTySize, SrcTySize));
+ return ConstantRange(std::move(LowerExt),
+ APInt::getOneBitSet(DstTySize, SrcTySize));
}
return ConstantRange(Lower.zext(DstTySize), Upper.zext(DstTySize));
if (NewLower == NewUpper)
return ConstantRange(getBitWidth(), /*isFullSet=*/true);
- ConstantRange X = ConstantRange(NewLower, NewUpper);
+ ConstantRange X = ConstantRange(std::move(NewLower), std::move(NewUpper));
if (X.isSizeStrictlySmallerThanOf(*this) ||
X.isSizeStrictlySmallerThanOf(Other))
// We've wrapped, therefore, full set.
if (NewLower == NewUpper)
return ConstantRange(getBitWidth(), /*isFullSet=*/true);
- ConstantRange X = ConstantRange(NewLower, NewUpper);
+ ConstantRange X = ConstantRange(std::move(NewLower), std::move(NewUpper));
if (X.isSizeStrictlySmallerThanOf(*this) ||
X.isSizeStrictlySmallerThanOf(Other))
// We've wrapped, therefore, full set.
APInt NewU = APIntOps::smax(getSignedMax(), Other.getSignedMax()) + 1;
if (NewU == NewL)
return ConstantRange(getBitWidth(), /*isFullSet=*/true);
- return ConstantRange(NewL, NewU);
+ return ConstantRange(std::move(NewL), std::move(NewU));
}
ConstantRange
APInt NewU = APIntOps::umax(getUnsignedMax(), Other.getUnsignedMax()) + 1;
if (NewU == NewL)
return ConstantRange(getBitWidth(), /*isFullSet=*/true);
- return ConstantRange(NewL, NewU);
+ return ConstantRange(std::move(NewL), std::move(NewU));
}
ConstantRange
APInt NewU = APIntOps::smin(getSignedMax(), Other.getSignedMax()) + 1;
if (NewU == NewL)
return ConstantRange(getBitWidth(), /*isFullSet=*/true);
- return ConstantRange(NewL, NewU);
+ return ConstantRange(std::move(NewL), std::move(NewU));
}
ConstantRange
APInt NewU = APIntOps::umin(getUnsignedMax(), Other.getUnsignedMax()) + 1;
if (NewU == NewL)
return ConstantRange(getBitWidth(), /*isFullSet=*/true);
- return ConstantRange(NewL, NewU);
+ return ConstantRange(std::move(NewL), std::move(NewU));
}
ConstantRange
if (Lower == Upper)
return ConstantRange(getBitWidth(), /*isFullSet=*/true);
- return ConstantRange(Lower, Upper);
+ return ConstantRange(std::move(Lower), std::move(Upper));
}
ConstantRange
APInt umin = APIntOps::umin(Other.getUnsignedMax(), getUnsignedMax());
if (umin.isAllOnesValue())
return ConstantRange(getBitWidth(), /*isFullSet=*/true);
- return ConstantRange(APInt::getNullValue(getBitWidth()), umin + 1);
+ return ConstantRange(APInt::getNullValue(getBitWidth()), std::move(umin) + 1);
}
ConstantRange
APInt umax = APIntOps::umax(getUnsignedMin(), Other.getUnsignedMin());
if (umax.isNullValue())
return ConstantRange(getBitWidth(), /*isFullSet=*/true);
- return ConstantRange(umax, APInt::getNullValue(getBitWidth()));
+ return ConstantRange(std::move(umax), APInt::getNullValue(getBitWidth()));
}
ConstantRange
// there's no overflow!
APInt Zeros(getBitWidth(), getUnsignedMax().countLeadingZeros());
if (Zeros.ugt(Other.getUnsignedMax()))
- return ConstantRange(min, max + 1);
+ return ConstantRange(std::move(min), std::move(max) + 1);
// FIXME: implement the other tricky cases
return ConstantRange(getBitWidth(), /*isFullSet=*/true);
if (min == max + 1)
return ConstantRange(getBitWidth(), /*isFullSet=*/true);
- return ConstantRange(min, max + 1);
+ return ConstantRange(std::move(min), std::move(max) + 1);
}
ConstantRange ConstantRange::inverse() const {