Factor out the code for testing whether a function accesses
[oota-llvm.git] / include / llvm / Analysis / AliasAnalysis.h
index 6b716ddee9478dde6b64166eaf1511e657a9cb2e..12b2090b174914d4bc8e95e9a1683335eeaf22c4 100644 (file)
@@ -268,14 +268,21 @@ public:
     return onlyReadsMemory(getModRefBehavior(F));
   }
 
-  /// onlyReadsMemory - If the functions with the specified behavior are known
-  /// to only read from non-volatile memory (or not access memory at all), return
-  /// true.  For use when the call site is not known.
+  /// onlyReadsMemory - Return true if functions with the specified behavior are
+  /// known to only read from non-volatile memory (or not access memory at all).
   ///
   static bool onlyReadsMemory(ModRefBehavior MRB) {
     return !(MRB & Mod);
   }
 
+  /// onlyAccessesArgPointees - Return true if functions with the specified
+  /// behavior are known to read at most from objects pointed to by their
+  /// pointer-typed arguments (with arbitrary offsets).
+  ///
+  static bool onlyAccessesArgPointees(ModRefBehavior MRB) {
+    return !(MRB & Anywhere & ~ArgumentPointees);
+  }
+
   /// getModRefInfo - Return information about whether or not an instruction may
   /// read or write the specified memory location.  An instruction
   /// that doesn't read or write memory may be trivially LICM'd for example.