aboutsummaryrefslogtreecommitdiff
path: root/lib/Support/ConstantRange.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Support/ConstantRange.cpp')
-rw-r--r--lib/Support/ConstantRange.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/lib/Support/ConstantRange.cpp b/lib/Support/ConstantRange.cpp
index 221ca948ca..b7b38e4c2e 100644
--- a/lib/Support/ConstantRange.cpp
+++ b/lib/Support/ConstantRange.cpp
@@ -146,14 +146,13 @@ APInt ConstantRange::getSetSize() const {
if (isEmptySet())
return APInt(getBitWidth()+1, 0);
- if (isFullSet())
- return APInt::getMaxValue(getBitWidth()).zext(getBitWidth()+1) + 1;
-
- if (isWrappedSet()) {
- APInt Result = Upper + (APInt::getMaxValue(getBitWidth()) - Lower + 1);
- return Result.zext(getBitWidth()+1);
+ if (isFullSet()) {
+ APInt Size(getBitWidth()+1, 0);
+ Size.setBit(getBitWidth());
+ return Size;
}
+ // This is also correct for wrapped sets.
return (Upper - Lower).zext(getBitWidth()+1);
}