if a function doesn't access memory at all, it definitely doesn't read it.
authorChris Lattner <sabre@nondot.org>
Wed, 23 Mar 2005 23:27:34 +0000 (23:27 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 23 Mar 2005 23:27:34 +0000 (23:27 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20794 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Analysis/AliasAnalysis.h

index 73b646d935663ac37fdca2e8214067313cd6246a..0857190c5c7faf9020aa5fed2c51768d548db897 100644 (file)
@@ -214,7 +214,8 @@ public:
   bool onlyReadsMemory(Function *F) {
     /// FIXME: If the analysis returns more precise info, we can reduce it to
     /// this.
-    return getModRefBehavior(F, CallSite()) == OnlyReadsMemory;
+    ModRefBehavior MRB = getModRefBehavior(F, CallSite());
+    return MRB == DoesNotAccessMemory || MRB == OnlyReadsMemory;
   }