[llvm-commits] [llvm] r118611 - /llvm/trunk/include/llvm/Analysis/AliasAnalysis.h

Dan Gohman gohman at apple.com
Tue Nov 9 11:43:24 PST 2010


Author: djg
Date: Tue Nov  9 13:43:24 2010
New Revision: 118611

URL: http://llvm.org/viewvc/llvm-project?rev=118611&view=rev
Log:
Factor out the logic for onlyReadsMemory into a helper function.

Modified:
    llvm/trunk/include/llvm/Analysis/AliasAnalysis.h

Modified: llvm/trunk/include/llvm/Analysis/AliasAnalysis.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/AliasAnalysis.h?rev=118611&r1=118610&r2=118611&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/AliasAnalysis.h (original)
+++ llvm/trunk/include/llvm/Analysis/AliasAnalysis.h Tue Nov  9 13:43:24 2010
@@ -247,8 +247,7 @@
   /// This property corresponds to the GCC 'pure' attribute.
   ///
   bool onlyReadsMemory(ImmutableCallSite CS) {
-    ModRefBehavior MRB = getModRefBehavior(CS);
-    return MRB == DoesNotAccessMemory || MRB == OnlyReadsMemory;
+    return onlyReadsMemory(getModRefBehavior(CS));
   }
 
   /// onlyReadsMemory - If the specified function is known to only read from
@@ -256,7 +255,14 @@
   /// when the call site is not known.
   ///
   bool onlyReadsMemory(const Function *F) {
-    ModRefBehavior MRB = getModRefBehavior(F);
+    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.
+  ///
+  static bool onlyReadsMemory(ModRefBehavior MRB) {
     return MRB == DoesNotAccessMemory || MRB == OnlyReadsMemory;
   }
 





More information about the llvm-commits mailing list