Add an isAllOnesValue utility function, similar to isZero and isOne.

llvm-svn: 74032
This commit is contained in:
Dan Gohman 2009-06-24 00:30:26 +00:00
parent f522a4e034
commit 18a96bb07f
2 changed files with 11 additions and 0 deletions

View File

@ -82,6 +82,11 @@ namespace llvm {
///
bool isOne() const;
/// isAllOnesValue - Return true if the expression is a constant
/// all-ones value.
///
bool isAllOnesValue() const;
/// replaceSymbolicValuesWithConcrete - If this SCEV internally references
/// the symbolic value "Sym", construct and return a new SCEV that produces
/// the same value, but which uses the concrete value Conc instead of the

View File

@ -132,6 +132,12 @@ bool SCEV::isOne() const {
return false;
}
bool SCEV::isAllOnesValue() const {
if (const SCEVConstant *SC = dyn_cast<SCEVConstant>(this))
return SC->getValue()->isAllOnesValue();
return false;
}
SCEVCouldNotCompute::SCEVCouldNotCompute() :
SCEV(scCouldNotCompute) {}