OSDN Git Service

Add an isAllOnesValue utility function, similar to isZero and isOne.
authorDan Gohman <gohman@apple.com>
Wed, 24 Jun 2009 00:30:26 +0000 (00:30 +0000)
committerDan Gohman <gohman@apple.com>
Wed, 24 Jun 2009 00:30:26 +0000 (00:30 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74032 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Analysis/ScalarEvolution.h
lib/Analysis/ScalarEvolution.cpp

index 1c1298a..311d0d0 100644 (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
index 5cbb5fa..6e5dfbb 100644 (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) {}