summaryrefslogtreecommitdiff
path: root/lib/Analysis/TypeBasedAliasAnalysis.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2010-10-11 23:39:34 +0000
committerDan Gohman <gohman@apple.com>2010-10-11 23:39:34 +0000
commit633e7023177837537adabf775395ebe7ab51b38f (patch)
tree5ffa9a9a8806672f2fa9ff495e0a8698c8f05c49 /lib/Analysis/TypeBasedAliasAnalysis.cpp
parent7c34730fb96808d7116d83b8831164042a98a4b1 (diff)
downloadllvm-633e7023177837537adabf775395ebe7ab51b38f.tar.gz
llvm-633e7023177837537adabf775395ebe7ab51b38f.tar.bz2
llvm-633e7023177837537adabf775395ebe7ab51b38f.tar.xz
Support AA chaining.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116264 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/TypeBasedAliasAnalysis.cpp')
-rw-r--r--lib/Analysis/TypeBasedAliasAnalysis.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/Analysis/TypeBasedAliasAnalysis.cpp b/lib/Analysis/TypeBasedAliasAnalysis.cpp
index 491a003435..546991ea0e 100644
--- a/lib/Analysis/TypeBasedAliasAnalysis.cpp
+++ b/lib/Analysis/TypeBasedAliasAnalysis.cpp
@@ -23,7 +23,6 @@
//
// TODO: getModRefBehavior. The AliasAnalysis infrastructure will need to
// be extended.
-// TODO: AA chaining
// TODO: struct fields
//
//===----------------------------------------------------------------------===//
@@ -84,6 +83,10 @@ namespace {
static char ID; // Class identification, replacement for typeinfo
TypeBasedAliasAnalysis() : ImmutablePass(ID) {}
+ virtual void initializePass() {
+ InitializeAliasAnalysis(this);
+ }
+
/// getAdjustedAnalysisPointer - This method is used when a pass implements
/// an analysis interface through multiple inheritance. If needed, it
/// should override this to adjust the this pointer as needed for the
@@ -122,9 +125,9 @@ TypeBasedAliasAnalysis::alias(const Location &LocA,
// Get the attached MDNodes. If either value lacks a tbaa MDNode, we must
// be conservative.
const MDNode *AM = LocA.TBAATag;
- if (!AM) return MayAlias;
+ if (!AM) return AliasAnalysis::alias(LocA, LocB);
const MDNode *BM = LocB.TBAATag;
- if (!BM) return MayAlias;
+ if (!BM) return AliasAnalysis::alias(LocA, LocB);
// Keep track of the root node for A and B.
TBAANode RootA, RootB;
@@ -133,7 +136,7 @@ TypeBasedAliasAnalysis::alias(const Location &LocA,
for (TBAANode T(AM); ; ) {
if (T.getNode() == BM)
// B is an ancestor of A.
- return MayAlias;
+ return AliasAnalysis::alias(LocA, LocB);
RootA = T;
T = T.getParent();
@@ -145,7 +148,7 @@ TypeBasedAliasAnalysis::alias(const Location &LocA,
for (TBAANode T(BM); ; ) {
if (T.getNode() == AM)
// A is an ancestor of B.
- return MayAlias;
+ return AliasAnalysis::alias(LocA, LocB);
RootB = T;
T = T.getParent();
@@ -161,7 +164,7 @@ TypeBasedAliasAnalysis::alias(const Location &LocA,
// If they have different roots, they're part of different potentially
// unrelated type systems, so we must be conservative.
- return MayAlias;
+ return AliasAnalysis::alias(LocA, LocB);
}
bool TypeBasedAliasAnalysis::pointsToConstantMemory(const Location &Loc) {