summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/ScalarEvolution.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2009-06-24 00:30:26 +0000
committerDan Gohman <gohman@apple.com>2009-06-24 00:30:26 +0000
commit18a96bb07fd92d618fe9cae09d101e16a9387361 (patch)
treed542753dcdc15b25ab98aebf7007719fd59e2133 /llvm/lib/Analysis/ScalarEvolution.cpp
parentf522a4e03405182ce4d79ca71195d939a5fec3cb (diff)
downloadbcm5719-llvm-18a96bb07fd92d618fe9cae09d101e16a9387361.tar.gz
bcm5719-llvm-18a96bb07fd92d618fe9cae09d101e16a9387361.zip
Add an isAllOnesValue utility function, similar to isZero and isOne.
llvm-svn: 74032
Diffstat (limited to 'llvm/lib/Analysis/ScalarEvolution.cpp')
-rw-r--r--llvm/lib/Analysis/ScalarEvolution.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp
index 5cbb5fac8ac..6e5dfbb35ed 100644
--- a/llvm/lib/Analysis/ScalarEvolution.cpp
+++ b/llvm/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) {}
OpenPOWER on IntegriCloud