summaryrefslogtreecommitdiffstats
path: root/llvm/include
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2019-04-07 17:52:40 +0000
committerNikita Popov <nikita.ppv@gmail.com>2019-04-07 17:52:40 +0000
commitbad648a23e15829a7210cd194e3d3f3ea13a91f8 (patch)
treed67aa77ea4dd1694dffb934fd47d82bd04445b20 /llvm/include
parent3db93ac5d6d05b809da1f99379f8fb4a8c27fd0a (diff)
downloadbcm5719-llvm-bad648a23e15829a7210cd194e3d3f3ea13a91f8.tar.gz
bcm5719-llvm-bad648a23e15829a7210cd194e3d3f3ea13a91f8.zip
[ConstantRange] Add isAllNegative() and isAllNonNegative() methods
Add isAllNegative() and isAllNonNegative() methods to ConstantRange, which determine whether all values in the constant range are negative/non-negative. This is useful for replacing KnownBits isNegative() and isNonNegative() calls when changing code to use constant ranges. Differential Revision: https://reviews.llvm.org/D60264 llvm-svn: 357871
Diffstat (limited to 'llvm/include')
-rw-r--r--llvm/include/llvm/IR/ConstantRange.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/llvm/include/llvm/IR/ConstantRange.h b/llvm/include/llvm/IR/ConstantRange.h
index be5e297bf71..71b55ccd346 100644
--- a/llvm/include/llvm/IR/ConstantRange.h
+++ b/llvm/include/llvm/IR/ConstantRange.h
@@ -219,9 +219,15 @@ public:
/// Compare set size of this range with the range CR.
bool isSizeStrictlySmallerThan(const ConstantRange &CR) const;
- // Compare set size of this range with Value.
+ /// Compare set size of this range with Value.
bool isSizeLargerThan(uint64_t MaxSize) const;
+ /// Return true if all values in this range are negative.
+ bool isAllNegative() const;
+
+ /// Return true if all values in this range are non-negative.
+ bool isAllNonNegative() const;
+
/// Return the largest unsigned value contained in the ConstantRange.
APInt getUnsignedMax() const;
OpenPOWER on IntegriCloud