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 e7e963a6364b9cb4df51290bf4168ee9ad404382..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,7 +110,7 @@ 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.
@@ -158,9 +166,8 @@ 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]);
@@ -169,3 +176,4 @@ void DSAA::getMustAliases(Value *P, std::vector<Value*> &RetVals) {
 #endif
   return getAnalysis<AliasAnalysis>().getMustAliases(P, RetVals);
 }
+