diff options
author | Dan Gohman <gohman@apple.com> | 2010-11-08 16:08:43 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2010-11-08 16:08:43 +0000 |
commit | 431c794ade88f5da17ba06436f781b009c745dde (patch) | |
tree | bd361eab854abb1596f4e057cba9b4c67d81c96a /lib/Analysis/BasicAliasAnalysis.cpp | |
parent | 6c25c920e66aa2d8f6b48454bc9770087ff7939a (diff) |
Teach BasicAliasAnalysis::getModRefBehavior(const Function *F)
to analyze intrinsic functions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118409 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/BasicAliasAnalysis.cpp')
-rw-r--r-- | lib/Analysis/BasicAliasAnalysis.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/Analysis/BasicAliasAnalysis.cpp b/lib/Analysis/BasicAliasAnalysis.cpp index 669202f859..221c8639e0 100644 --- a/lib/Analysis/BasicAliasAnalysis.cpp +++ b/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); } |