diff --git a/lib/Analysis/DataStructure/DataStructure.cpp b/lib/Analysis/DataStructure/DataStructure.cpp index 2c9a75c9a85..bf7ec77f0ff 100644 --- a/lib/Analysis/DataStructure/DataStructure.cpp +++ b/lib/Analysis/DataStructure/DataStructure.cpp @@ -1058,7 +1058,8 @@ void DSGraph::removeDeadNodes(unsigned Flags) { std::vector AuxFCallsAlive(AuxFunctionCalls.size()); for (unsigned i = 0, e = AuxFunctionCalls.size(); i != e; ++i) - if (CallSiteUsesAliveArgs(AuxFunctionCalls[i], Alive, Visited)) { + if (!(Flags & DSGraph::RemoveUnreachableGlobals) || + CallSiteUsesAliveArgs(AuxFunctionCalls[i], Alive, Visited)) { AuxFunctionCalls[i].markReachableNodes(Alive); AuxFCallsAlive[i] = true; }