aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2010-11-09 19:43:24 +0000
committerDan Gohman <gohman@apple.com>2010-11-09 19:43:24 +0000
commit467a0adfc8b6bd4b114e024c200c159497a4cd86 (patch)
tree16d289c9a267f20f0b9609805c39ad7783202f02
parent7293ac12811c8a43023830380e70c0fda941f8ec (diff)
Factor out the logic for onlyReadsMemory into a helper function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118611 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm/Analysis/AliasAnalysis.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/include/llvm/Analysis/AliasAnalysis.h b/include/llvm/Analysis/AliasAnalysis.h
index 5f9579778a..d97552ee77 100644
--- a/include/llvm/Analysis/AliasAnalysis.h
+++ b/include/llvm/Analysis/AliasAnalysis.h
@@ -247,8 +247,7 @@ public:
/// 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 @@ public:
/// 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;
}