[llvm-commits] [llvm] r118409 - /llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp
Dan Gohman
gohman at apple.com
Mon Nov 8 08:08:43 PST 2010
Author: djg
Date: Mon Nov 8 10:08:43 2010
New Revision: 118409
URL: http://llvm.org/viewvc/llvm-project?rev=118409&view=rev
Log:
Teach BasicAliasAnalysis::getModRefBehavior(const Function *F)
to analyze intrinsic functions.
Modified:
llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp
Modified: llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp?rev=118409&r1=118408&r2=118409&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp (original)
+++ llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp Mon Nov 8 10:08:43 2010
@@ -553,14 +553,22 @@
/// 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);
}
More information about the llvm-commits
mailing list