In the TD pass, don't iterate over the scalar map to find the globals, iterate over
[oota-llvm.git] / lib / Analysis / DataStructure / DataStructureAA.cpp
index 4940e9d0fc591bf12d301411ea698d430ed67375..8a2e0caa425c274850c19294d9369c5180651a8d 100644 (file)
@@ -1,4 +1,11 @@
 //===- 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.
@@ -9,6 +16,7 @@
 #include "llvm/Analysis/DSGraph.h"
 #include "llvm/Analysis/AliasAnalysis.h"
 #include "llvm/Module.h"
+using namespace llvm;
 
 namespace {
   class DSAA : public Pass, public AliasAnalysis {
@@ -102,11 +110,12 @@ AliasAnalysis::AliasResult DSAA::alias(const Value *V1, unsigned V1Size,
       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.
         //
@@ -115,6 +124,7 @@ AliasAnalysis::AliasResult DSAA::alias(const Value *V1, unsigned V1Size,
 
         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...
@@ -146,6 +156,7 @@ AliasAnalysis::AliasResult DSAA::alias(const Value *V1, unsigned V1Size,
 /// 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.
@@ -155,14 +166,14 @@ void DSAA::getMustAliases(Value *P, std::vector<Value*> &RetVals) {
     
     // 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);
 }
+