OSDN Git Service

revert my patch, duncan points out what is wrong with my logic. Add
authorChris Lattner <sabre@nondot.org>
Wed, 2 Sep 2009 04:39:04 +0000 (04:39 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 2 Sep 2009 04:39:04 +0000 (04:39 +0000)
a comment so that I don't change this in the future :)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80760 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/IPA/CallGraphSCCPass.cpp

index 25964b2..66ccb8a 100644 (file)
@@ -177,12 +177,16 @@ void CGPassManager::RefreshCallGraph(std::vector<CallGraphNode*> &CurSCC,
         assert(!CheckingMode &&
                "CallGraphSCCPass did not update the CallGraph correctly!");
         
-        // Just remove the edge from the set of callees.
+        // Just remove the edge from the set of callees, keep track of whether
+        // I points to the last element of the vector.
+        bool WasLast = I + 1 == E;
         CGN->removeCallEdge(I);
         
-        // If we removed the last edge, get out of the loop.
-        if (CGN->empty()) break;
-        
+        // If I pointed to the last element of the vector, we have to bail out:
+        // iterator checking rejects comparisons of the resultant pointer with
+        // end.
+        if (WasLast)
+          break;
         E = CGN->end();
         continue;
       }