Move a method that creates constant ranges relative to another constant range

per icmp predicate out of predsimplify and into ConstantRange.

Add another utility method that determines whether one range is a subset of
another. Combine with the former to determine whether icmp pred range, range
is known to be true or not.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75357 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Nick Lewycky
2009-07-11 06:15:39 +00:00
parent 8955e93b1f
commit bf8c7f0adf
3 changed files with 87 additions and 54 deletions

View File

@@ -58,6 +58,12 @@ public:
/// assert out if the two APInt's are not the same bit width.
ConstantRange(const APInt& Lower, const APInt& Upper);
/// makeICmpRegion - Return the range of values that a value must be within
/// in order for the comparison specified by the predicate against range
/// Other to be true.
static ConstantRange makeICmpRegion(unsigned Pred,
const ConstantRange &Other);
/// getLower - Return the lower value for this range...
///
const APInt &getLower() const { return Lower; }
@@ -88,6 +94,10 @@ public:
///
bool contains(const APInt &Val) const;
/// contains - Return true if the other range is a subset of this one.
///
bool contains(const ConstantRange &CR) const;
/// getSingleElement - If this set contains a single element, return it,
/// otherwise return null.
///