summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2010-11-08 16:08:43 +0000
committerDan Gohman <gohman@apple.com>2010-11-08 16:08:43 +0000
commite461d7d1355c21f54e6ea6c6906a4e22e9543da6 (patch)
treed7060f00ddf54278c31652a15a1f11dfce0912d8 /llvm/lib
parent6cf44b0353976b4ec80596478e56aad27139c91f (diff)
downloadbcm5719-llvm-e461d7d1355c21f54e6ea6c6906a4e22e9543da6.tar.gz
bcm5719-llvm-e461d7d1355c21f54e6ea6c6906a4e22e9543da6.zip
Teach BasicAliasAnalysis::getModRefBehavior(const Function *F)
to analyze intrinsic functions. llvm-svn: 118409
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Analysis/BasicAliasAnalysis.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/llvm/lib/Analysis/BasicAliasAnalysis.cpp b/llvm/lib/Analysis/BasicAliasAnalysis.cpp
index 669202f8599..221c8639e0f 100644
--- a/llvm/lib/Analysis/BasicAliasAnalysis.cpp
+++ b/llvm/lib/Analysis/BasicAliasAnalysis.cpp
@@ -553,14 +553,22 @@ BasicAliasAnalysis::getModRefBehavior(ImmutableCallSite CS) {
/// For use when the call site is not known.
AliasAnalysis::ModRefBehavior
BasicAliasAnalysis::getModRefBehavior(const Function *F) {
+ // If the function declares it doesn't access memory, we can't do better.
if (F->doesNotAccessMemory())
- // Can't do better than this.
return DoesNotAccessMemory;
+
+ // For intrinsics, we can check the table.
+ if (unsigned iid = F->getIntrinsicID()) {
+#define GET_INTRINSIC_MODREF_BEHAVIOR
+#include "llvm/Intrinsics.gen"
+#undef GET_INTRINSIC_MODREF_BEHAVIOR
+ }
+
+ // If the function declares it only reads memory, go with that.
if (F->onlyReadsMemory())
return OnlyReadsMemory;
- if (unsigned id = F->getIntrinsicID())
- return getIntrinsicModRefBehavior(id);
+ // Otherwise be conservative.
return AliasAnalysis::getModRefBehavior(F);
}
OpenPOWER on IntegriCloud