Make error messages more useful than jsut an abort
[oota-llvm.git] / lib / Analysis / DataStructure / IPModRef.cpp
index 8c507e9323a0654d969d285e153bc423386b9d27..a8aa6c2ec0f78c6aea2b424421cfb8db140759a8 100644 (file)
@@ -118,7 +118,7 @@ void FunctionModRefInfo::computeModRef(const Function &func)
 //       function or we cannot determine the complete set of functions invoked).
 //
 DSGraph* FunctionModRefInfo::ResolveCallSiteModRefInfo(CallInst &CI,
-                               std::map<const DSNode*, DSNodeHandle> &NodeMap)
+                               hash_map<const DSNode*, DSNodeHandle> &NodeMap)
 {
   // Step #0: Quick check if we are going to fail anyway: avoid
   // all the graph cloning and map copying in steps #1 and #2.
@@ -144,7 +144,7 @@ DSGraph* FunctionModRefInfo::ResolveCallSiteModRefInfo(CallInst &CI,
   Result->maskNodeTypes(~(DSNode::Modified | DSNode::Read));
 
   // Step #3: clone the bottom up graphs for the callees into the caller graph
-  if (const Function *F = CI.getCalledFunction())
+  if (Function *F = CI.getCalledFunction())
     {
       assert(!F->isExternal());
 
@@ -162,7 +162,7 @@ DSGraph* FunctionModRefInfo::ResolveCallSiteModRefInfo(CallInst &CI,
           Args.push_back(Result->getNodeForValue(CI.getOperand(i)));
 
       // Build the call site...
-      DSCallSite CS(CI, RetVal, 0, Args);
+      DSCallSite CS(CI, RetVal, F, Args);
 
       // Perform the merging now of the graph for the callee, which will
       // come with mod/ref bits set...
@@ -175,7 +175,7 @@ DSGraph* FunctionModRefInfo::ResolveCallSiteModRefInfo(CallInst &CI,
     assert(0 && "See error message");
 
   // Remove dead nodes aggressively to match the caller's original graph.
-  Result->removeDeadNodes();
+  Result->removeDeadNodes(DSGraph::KeepUnreachableGlobals);
 
   // Step #4: Return the clone + the mapping (by ref)
   return Result;
@@ -194,7 +194,7 @@ FunctionModRefInfo::computeModRef(const CallInst& callInst)
   callSiteModRefInfo[&callInst] = callModRefInfo;
 
   // Get a copy of the graph for the callee with the callee inlined
-  std::map<const DSNode*, DSNodeHandle> NodeMap;
+  hash_map<const DSNode*, DSNodeHandle> NodeMap;
   DSGraph* csgp = ResolveCallSiteModRefInfo(const_cast<CallInst&>(callInst),
                                             NodeMap);
   if (!csgp)
@@ -238,7 +238,7 @@ public:
     knownValues.resize(tdGraph.getGraphSize());
 
     // For every identifiable value, save Value pointer in knownValues[i]
-    for (std::map<Value*, DSNodeHandle>::const_iterator
+    for (hash_map<Value*, DSNodeHandle>::const_iterator
            I = tdGraph.getScalarMap().begin(),
            E = tdGraph.getScalarMap().end(); I != E; ++I)
       if (isa<GlobalValue>(I->first) ||
@@ -393,7 +393,7 @@ FunctionModRefInfo& IPModRef::getFuncInfo(const Function& func,
       // The memory for this graph clone will be freed by FunctionModRefInfo.
       DSGraph* funcTDGraph =
         new DSGraph(getAnalysis<TDDataStructures>().getDSGraph(func));
-      funcTDGraph->removeDeadNodes();
+      funcTDGraph->removeDeadNodes(DSGraph::KeepUnreachableGlobals);
 
       funcInfo = new FunctionModRefInfo(func, *this, funcTDGraph); //auto-insert
       funcInfo->computeModRef(func);  // computes the mod/ref info