[llvm-commits] [llvm] r80760 - /llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp

Chris Lattner sabre at nondot.org
Tue Sep 1 21:39:04 PDT 2009


Author: lattner
Date: Tue Sep  1 23:39:04 2009
New Revision: 80760

URL: http://llvm.org/viewvc/llvm-project?rev=80760&view=rev
Log:
revert my patch, duncan points out what is wrong with my logic.  Add
a comment so that I don't change this in the future :)

Modified:
    llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp

Modified: llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp?rev=80760&r1=80759&r2=80760&view=diff

==============================================================================
--- llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp (original)
+++ llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp Tue Sep  1 23:39:04 2009
@@ -177,12 +177,16 @@
         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;
       }





More information about the llvm-commits mailing list