do not (implicitly) dereference iterator many times, cache it instead
[oota-llvm.git] / lib / Target / PIC16 / PIC16Passes / PIC16Overlay.cpp
index 5ecb6aa5515768b1843b268d786bc20587b55cda..0f8928a4b5f5039de69d5a2f3af1bc9531413267 100644 (file)
@@ -171,8 +171,9 @@ void PIC16Overlay::MarkIndirectlyCalledFunctions(Module &M) {
   for (Module::iterator MI = M.begin(), E = M.end(); MI != E; ++MI) {
     for (Value::use_iterator I = MI->use_begin(), E = MI->use_end(); I != E;
          ++I) {
-      if ((!isa<CallInst>(I) && !isa<InvokeInst>(I))
-          || !CallSite(cast<Instruction>(I)).isCallee(I)) {
+      User *U = *I;
+      if ((!isa<CallInst>(U) && !isa<InvokeInst>(U))
+          || !CallSite(cast<Instruction>(U)).isCallee(I)) {
         setColor(MI, ++IndirectCallColor);
         break;
       }