[llvm-commits] [llvm] r108421 - /llvm/trunk/lib/Analysis/ProfileInfo.cpp

Gabor Greif ggreif at gmail.com
Thu Jul 15 03:19:23 PDT 2010


Author: ggreif
Date: Thu Jul 15 05:19:23 2010
New Revision: 108421

URL: http://llvm.org/viewvc/llvm-project?rev=108421&view=rev
Log:
cache another dereferenced iterator

Modified:
    llvm/trunk/lib/Analysis/ProfileInfo.cpp

Modified: llvm/trunk/lib/Analysis/ProfileInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ProfileInfo.cpp?rev=108421&r1=108420&r2=108421&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ProfileInfo.cpp (original)
+++ llvm/trunk/lib/Analysis/ProfileInfo.cpp Thu Jul 15 05:19:23 2010
@@ -71,22 +71,24 @@
 
   // Are there zero predecessors of this block?
   if (PI == PE) {
-    Edge e = getEdge(0,BB);
+    Edge e = getEdge(0, BB);
     Count = getEdgeWeight(e);
   } else {
     // Otherwise, if there are predecessors, the execution count of this block is
     // the sum of the edge frequencies from the incoming edges.
     std::set<const BasicBlock*> ProcessedPreds;
     Count = 0;
-    for (; PI != PE; ++PI)
-      if (ProcessedPreds.insert(*PI).second) {
-        double w = getEdgeWeight(getEdge(*PI, BB));
+    for (; PI != PE; ++PI) {
+      const BasicBlock *P = *PI;
+      if (ProcessedPreds.insert(P).second) {
+        double w = getEdgeWeight(getEdge(P, BB));
         if (w == MissingValue) {
           Count = MissingValue;
           break;
         }
         Count += w;
       }
+    }
   }
 
   // If the predecessors did not suffice to get block weight, try successors.





More information about the llvm-commits mailing list