summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/ConstantRange.cpp
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@gmail.com>2017-05-09 07:04:02 +0000
committerCraig Topper <craig.topper@gmail.com>2017-05-09 07:04:02 +0000
commit79b7666f02af974052e2d0340077ed9fd8259dbc (patch)
treea131a0bc0f496f3d39ff910fe4cf078448fbfc92 /llvm/lib/IR/ConstantRange.cpp
parent61729fd036f108cf56a7fe30578faa7e50dc180b (diff)
downloadbcm5719-llvm-79b7666f02af974052e2d0340077ed9fd8259dbc.tar.gz
bcm5719-llvm-79b7666f02af974052e2d0340077ed9fd8259dbc.zip
[ConstantRange] Combine the two adds max+1 in lshr into a single addition.
llvm-svn: 302509
Diffstat (limited to 'llvm/lib/IR/ConstantRange.cpp')
-rw-r--r--llvm/lib/IR/ConstantRange.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/IR/ConstantRange.cpp b/llvm/lib/IR/ConstantRange.cpp
index a7c857a1f9b..6801ed4fb51 100644
--- a/llvm/lib/IR/ConstantRange.cpp
+++ b/llvm/lib/IR/ConstantRange.cpp
@@ -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 {
OpenPOWER on IntegriCloud