summaryrefslogtreecommitdiffstats
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
commit007484527b0aac05534c0d539c6091ccf0132045 (patch)
tree0d5b956418a9c02af71de7b1953e6af18bc1ff8e
parentf501579f8ae3112017b9dbea2fa0895697e3f7fb (diff)
downloadbcm5719-llvm-007484527b0aac05534c0d539c6091ccf0132045.tar.gz
bcm5719-llvm-007484527b0aac05534c0d539c6091ccf0132045.zip
Factor out the logic for onlyReadsMemory into a helper function.
llvm-svn: 118611
-rw-r--r--llvm/include/llvm/Analysis/AliasAnalysis.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/llvm/include/llvm/Analysis/AliasAnalysis.h b/llvm/include/llvm/Analysis/AliasAnalysis.h
index 5f9579778ad..d97552ee77d 100644
--- a/llvm/include/llvm/Analysis/AliasAnalysis.h
+++ b/llvm/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;
}
OpenPOWER on IntegriCloud