Fix for PR341
[oota-llvm.git] / lib / Analysis / DataStructure / Steensgaard.cpp
index a3034ddeac2da6d65054825a31e2f492318365de..5b055dc345ae828a06598135099f48b030b2a746 100644 (file)
@@ -1,4 +1,11 @@
 //===- Steensgaard.cpp - Context Insensitive 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 data structure graphs to implement a simple context
 // insensitive alias analysis.  It does this by computing the local analysis
 //
 //===----------------------------------------------------------------------===//
 
-#include "llvm/Analysis/DataStructure.h"
-#include "llvm/Analysis/DSGraph.h"
+#include "llvm/Analysis/DataStructure/DataStructure.h"
+#include "llvm/Analysis/DataStructure/DSGraph.h"
 #include "llvm/Analysis/AliasAnalysis.h"
 #include "llvm/Module.h"
 #include "Support/Debug.h"
+#include <iostream>
+using namespace llvm;
 
 namespace {
   class Steens : public Pass, public AliasAnalysis {
@@ -39,7 +48,6 @@ namespace {
       AliasAnalysis::getAnalysisUsage(AU);
       AU.setPreservesAll();                    // Does not transform code...
       AU.addRequired<LocalDataStructures>();   // Uses local dsgraph
-      AU.addRequired<AliasAnalysis>();         // Chains to another AA impl...
     }
 
     // print - Implement the Pass::print method...
@@ -69,7 +77,6 @@ namespace {
   RegisterAnalysisGroup<AliasAnalysis, Steens> Y;
 }
 
-
 /// ResolveFunctionCall - Resolve the actual arguments of a call to function F
 /// with the specified call site descriptor.  This function links the arguments
 /// and the return value for the call site context-insensitively.
@@ -103,8 +110,8 @@ bool Steens::run(Module &M) {
   LocalDataStructures &LDS = getAnalysis<LocalDataStructures>();
 
   // Create a new, empty, graph...
-  ResultGraph = new DSGraph();
-  GlobalsGraph = new DSGraph();
+  ResultGraph = new DSGraph(getTargetData());
+  GlobalsGraph = new DSGraph(getTargetData());
   ResultGraph->setGlobalsGraph(GlobalsGraph);
   ResultGraph->setPrintAuxCalls();
 
@@ -123,7 +130,8 @@ bool Steens::run(Module &M) {
       {  // Scope to free NodeMap memory ASAP
         DSGraph::NodeMapTy NodeMap;
         const DSGraph &FDSG = LDS.getDSGraph(*I);
-        ResultGraph->cloneInto(FDSG, ValMap, RetValMap, NodeMap);
+        ResultGraph->cloneInto(FDSG, ValMap, RetValMap, NodeMap,
+                               DSGraph::UpdateInlinedGlobals);
       }
 
       // Incorporate the inlined Function's ScalarMap into the global
@@ -226,5 +234,5 @@ AliasAnalysis::AliasResult Steens::alias(const Value *V1, unsigned V1Size,
   // If we cannot determine alias properties based on our graph, fall back on
   // some other AA implementation.
   //
-  return getAnalysis<AliasAnalysis>().alias(V1, V1Size, V2, V2Size);
+  return AliasAnalysis::alias(V1, V1Size, V2, V2Size);
 }