//===- DataStructureAA.cpp - Data Structure Based Alias Analysis ----------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file was developed by the LLVM research group and is distributed under
+// the University of Illinois Open Source License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
//
// This pass uses the top-down data structure graphs to implement a simple
// context sensitive alias analysis.
#include "llvm/Analysis/DSGraph.h"
#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/Module.h"
+using namespace llvm;
namespace {
class DSAA : public Pass, public AliasAnalysis {
DSNode *N1 = I->second.getNode(), *N2 = J->second.getNode();
unsigned O1 = I->second.getOffset(), O2 = J->second.getOffset();
- // We can only make a judgement of one of the nodes is complete...
+ // We can only make a judgment of one of the nodes is complete...
if (N1->isComplete() || N2->isComplete()) {
if (N1 != N2)
return NoAlias; // Completely different nodes.
+#if 0 // This does not correctly handle arrays!
// Both point to the same node and same offset, and there is only one
// physical memory object represented in the node, return must alias.
//
if (O1 == O2 && isSinglePhysicalObject(N1))
return MustAlias; // Exactly the same object & offset
+#endif
// See if they point to different offsets... if so, we may be able to
// determine that they do not alias...
/// specified vector.
///
void DSAA::getMustAliases(Value *P, std::vector<Value*> &RetVals) {
+#if 0 // This does not correctly handle arrays!
// Currently the only must alias information we can provide is to say that
// something is equal to a global value. If we already have a global value,
// don't get worked up about it.
// The only must alias information we can currently determine occurs when
// the node for P is a global node with only one entry.
- const DSGraph::ScalarMapTy &GSM = G->getScalarMap();
- DSGraph::ScalarMapTy::const_iterator I = GSM.find(P);
- if (I != GSM.end()) {
+ DSGraph::ScalarMapTy::const_iterator I = G->getScalarMap().find(P);
+ if (I != G->getScalarMap().end()) {
DSNode *N = I->second.getNode();
if (N->isComplete() && isSinglePhysicalObject(N))
RetVals.push_back(N->getGlobals()[0]);
}
}
-
+#endif
return getAnalysis<AliasAnalysis>().getMustAliases(P, RetVals);
}
+