1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 19:52:54 +01:00

[ConstantRange] Combine the two adds max+1 in lshr into a single addition.

llvm-svn: 302509
This commit is contained in:
Craig Topper 2017-05-09 07:04:02 +00:00
parent 4b11266674
commit 0a38cca54d

View File

@ -908,13 +908,13 @@ ConstantRange
ConstantRange::lshr(const ConstantRange &Other) const {
if (isEmptySet() || Other.isEmptySet())
return ConstantRange(getBitWidth(), /*isFullSet=*/false);
APInt max = getUnsignedMax().lshr(Other.getUnsignedMin());
APInt max = getUnsignedMax().lshr(Other.getUnsignedMin()) + 1;
APInt min = getUnsignedMin().lshr(Other.getUnsignedMax());
if (min == max + 1)
if (min == max)
return ConstantRange(getBitWidth(), /*isFullSet=*/true);
return ConstantRange(std::move(min), std::move(max) + 1);
return ConstantRange(std::move(min), std::move(max));
}
ConstantRange ConstantRange::inverse() const {