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

Duncan Sands baldrick at free.fr
Tue Sep 1 20:48:42 PDT 2009


Author: baldrick
Date: Tue Sep  1 22:48:41 2009
New Revision: 80757

URL: http://llvm.org/viewvc/llvm-project?rev=80757&view=rev
Log:
Complicate Chris's simplification, avoiding complaints
about singular iterators when building with expensive
checks turned on.

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=80757&r1=80756&r2=80757&view=diff

==============================================================================
--- llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp (original)
+++ llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp Tue Sep  1 22:48:41 2009
@@ -161,7 +161,7 @@
     // CGN with those actually in the function.
     
     // Get the set of call sites currently in the function.
-    for (CallGraphNode::iterator I = CGN->begin(), E = CGN->end(); I != E; ){
+    for (CallGraphNode::iterator I = CGN->begin(), E = CGN->end(); I != E; ) {
       // If this call site is null, then the function pass deleted the call
       // entirely and the WeakVH nulled it out.  
       if (I->first == 0 ||
@@ -178,7 +178,11 @@
                "CallGraphSCCPass did not update the CallGraph correctly!");
         
         // Just remove the edge from the set of callees.
+        bool wasLast = I + 1 == E;
         CGN->removeCallEdge(I);
+        if (wasLast)
+          // I is now a singular iterator, do not compare with E.
+          break;
         E = CGN->end();
         continue;
       }





More information about the llvm-commits mailing list