* Eliminate boolean arguments in favor of using enums
* T-D pass now eliminates unreachable globals


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5419 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Analysis/DataStructure/DataStructure.cpp b/lib/Analysis/DataStructure/DataStructure.cpp
index 0e61f03..f151951 100644
--- a/lib/Analysis/DataStructure/DataStructure.cpp
+++ b/lib/Analysis/DataStructure/DataStructure.cpp
@@ -785,9 +785,9 @@
 // scope of current analysis may have modified it), the 'Incomplete' flag is
 // added to the NodeType.
 //
-void DSGraph::markIncompleteNodes(bool markFormalArgs) {
+void DSGraph::markIncompleteNodes(unsigned Flags) {
   // Mark any incoming arguments as incomplete...
-  if (markFormalArgs && Func)
+  if ((Flags & DSGraph::MarkFormalArgs) && Func)
     for (Function::aiterator I = Func->abegin(), E = Func->aend(); I != E; ++I)
       if (isPointerType(I->getType()) && ScalarMap.find(I) != ScalarMap.end())
         markIncompleteNode(ScalarMap[I].getNode());
@@ -1010,7 +1010,7 @@
 // from the caller's graph entirely.  This is only appropriate to use when
 // inlining graphs.
 //
-void DSGraph::removeDeadNodes() {
+void DSGraph::removeDeadNodes(unsigned Flags) {
   // Reduce the amount of work we have to do...
   removeTriviallyDeadNodes();
 
@@ -1023,10 +1023,11 @@
   // Mark all nodes reachable by (non-global) scalar nodes as alive...
   for (std::map<Value*, DSNodeHandle>::iterator I = ScalarMap.begin(),
          E = ScalarMap.end(); I != E; ++I)
-    // if (!isa<GlobalValue>(I->first))              // Don't mark globals!
+    if (!(Flags & DSGraph::RemoveUnreachableGlobals) ||
+        !isa<GlobalValue>(I->first))              // Don't mark globals!
       markAlive(I->second.getNode(), Alive);
-    // else                    // Keep track of global nodes
-    //   GlobalNodes.push_back(std::make_pair(I->first, I->second.getNode()));
+    else                    // Keep track of global nodes
+      GlobalNodes.push_back(std::make_pair(I->first, I->second.getNode()));
 
   // The return value is alive as well...
   markAlive(RetNode.getNode(), Alive);