aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Analysis
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
commitf05118e304be294d811252fea3b4c4ef0f46406d (patch)
treef966417c557d1dd801ea36b91cf7b694ab8f7062 /lib/Analysis
parenta7d79b39bb73115516186a25be15f74099a4f48b (diff)
downloadexternal_llvm-f05118e304be294d811252fea3b4c4ef0f46406d.zip
external_llvm-f05118e304be294d811252fea3b4c4ef0f46406d.tar.gz
external_llvm-f05118e304be294d811252fea3b4c4ef0f46406d.tar.bz2
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
Diffstat (limited to 'lib/Analysis')
-rw-r--r--lib/Analysis/ScalarEvolution.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/Analysis/ScalarEvolution.cpp b/lib/Analysis/ScalarEvolution.cpp
index 5cbb5fa..6e5dfbb 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) {}