diff options
author | Dan Gohman <gohman@apple.com> | 2009-06-24 00:30:26 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2009-06-24 00:30:26 +0000 |
commit | 4d289bf4af88759be173a1a809bf8c092d729764 (patch) | |
tree | f966417c557d1dd801ea36b91cf7b694ab8f7062 | |
parent | ea080be98625d86dc0a574f71d7df69e2351734c (diff) |
Add an isAllOnesValue utility function, similar to isZero and isOne.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74032 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/llvm/Analysis/ScalarEvolution.h | 5 | ||||
-rw-r--r-- | lib/Analysis/ScalarEvolution.cpp | 6 |
2 files changed, 11 insertions, 0 deletions
diff --git a/include/llvm/Analysis/ScalarEvolution.h b/include/llvm/Analysis/ScalarEvolution.h index 1c1298a9a1..311d0d03e0 100644 --- a/include/llvm/Analysis/ScalarEvolution.h +++ b/include/llvm/Analysis/ScalarEvolution.h @@ -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 diff --git a/lib/Analysis/ScalarEvolution.cpp b/lib/Analysis/ScalarEvolution.cpp index 5cbb5fac8a..6e5dfbb35e 100644 --- a/lib/Analysis/ScalarEvolution.cpp +++ b/lib/Analysis/ScalarEvolution.cpp @@ -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) {} |