[llvm-commits] [llvm] r107963 - /llvm/trunk/lib/Analysis/IPA/CallGraph.cpp

Gabor Greif ggreif at gmail.com
Fri Jul 9 06:17:13 PDT 2010


Author: ggreif
Date: Fri Jul  9 08:17:13 2010
New Revision: 107963

URL: http://llvm.org/viewvc/llvm-project?rev=107963&view=rev
Log:
do not repeatedly dereference use_iterator

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

Modified: llvm/trunk/lib/Analysis/IPA/CallGraph.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/IPA/CallGraph.cpp?rev=107963&r1=107962&r2=107963&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/IPA/CallGraph.cpp (original)
+++ llvm/trunk/lib/Analysis/IPA/CallGraph.cpp Fri Jul  9 08:17:13 2010
@@ -126,13 +126,15 @@
     }
 
     // Loop over all of the users of the function, looking for non-call uses.
-    for (Value::use_iterator I = F->use_begin(), E = F->use_end(); I != E; ++I)
-      if ((!isa<CallInst>(I) && !isa<InvokeInst>(I))
-          || !CallSite(cast<Instruction>(I)).isCallee(I)) {
+    for (Value::use_iterator I = F->use_begin(), E = F->use_end(); I != E; ++I){
+      User *U = *I;
+      if ((!isa<CallInst>(U) && !isa<InvokeInst>(U))
+          || !CallSite(cast<Instruction>(U)).isCallee(I)) {
         // Not a call, or being used as a parameter rather than as the callee.
         ExternalCallingNode->addCalledFunction(CallSite(), Node);
         break;
       }
+    }
 
     // If this function is not defined in this translation unit, it could call
     // anything.





More information about the llvm-commits mailing list