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, 11 insertions, 0 deletions
diff --git a/lib/Support/ConstantRange.cpp b/lib/Support/ConstantRange.cpp
index fb0442823c..26a23efe03 100644
--- a/lib/Support/ConstantRange.cpp
+++ b/lib/Support/ConstantRange.cpp
@@ -655,6 +655,17 @@ ConstantRange::lshr(const ConstantRange &Amount) const {
return ConstantRange(min, max);
}
+ConstantRange ConstantRange::inverse() const {
+ if (isFullSet()) {
+ return ConstantRange(APInt::getNullValue(Lower.getBitWidth()),
+ APInt::getNullValue(Lower.getBitWidth()));
+ } else if (isEmptySet()) {
+ return ConstantRange(APInt::getAllOnesValue(Lower.getBitWidth()),
+ APInt::getAllOnesValue(Lower.getBitWidth()));
+ }
+ return ConstantRange(Upper, Lower);
+}
+
/// print - Print out the bounds to a stream...
///
void ConstantRange::print(raw_ostream &OS) const {