Don't mess up SCC traversal when a node has null edges out of it.
authorChris Lattner <sabre@nondot.org>
Mon, 25 Apr 2005 19:16:17 +0000 (19:16 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 25 Apr 2005 19:16:17 +0000 (19:16 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21536 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/DataStructure/DataStructure.cpp

index a95d2522a0a205c76708c1e6afd48d02a7c324f5..904d8b10b769c53fcbea35d79376de8776d1c99b 100644 (file)
@@ -1430,11 +1430,12 @@ VisitForSCCs(const DSNode *N) {
   // Otherwise, check all successors.
   bool AnyDirectSuccessorsReachClonedNodes = false;
   for (DSNode::const_edge_iterator EI = N->edge_begin(), EE = N->edge_end();
-       EI != EE; ++EI) {
-    std::pair<unsigned, bool> &SuccInfo = VisitForSCCs(EI->getNode());
-    if (SuccInfo.first < Min) Min = SuccInfo.first;
-    AnyDirectSuccessorsReachClonedNodes |= SuccInfo.second;
-  }
+       EI != EE; ++EI)
+    if (DSNode *Succ = EI->getNode()) {
+      std::pair<unsigned, bool> &SuccInfo = VisitForSCCs(Succ);
+      if (SuccInfo.first < Min) Min = SuccInfo.first;
+      AnyDirectSuccessorsReachClonedNodes |= SuccInfo.second;
+    }
 
   if (Min != MyId)
     return ThisNodeInfo;  // Part of a large SCC.  Leave self on stack.