[PATCH] D40891: Fix accidentally quadratic time in BlockFrequencyInfoImpl::propagateMassToSuccessors

Andrew Scheidecker via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 6 15:17:34 PST 2017


AndrewScheidecker updated this revision to Diff 125823.
AndrewScheidecker added a comment.

Ran the patch through clang-format


Repository:
  rL LLVM

https://reviews.llvm.org/D40891

Files:
  include/llvm/Analysis/BlockFrequencyInfoImpl.h


Index: include/llvm/Analysis/BlockFrequencyInfoImpl.h
===================================================================
--- include/llvm/Analysis/BlockFrequencyInfoImpl.h
+++ include/llvm/Analysis/BlockFrequencyInfoImpl.h
@@ -1314,11 +1314,14 @@
       return false;
   } else {
     const BlockT *BB = getBlock(Node);
-    for (const auto Succ : children<const BlockT *>(BB))
-      if (!addToDist(Dist, OuterLoop, Node, getNode(Succ),
-                     getWeightFromBranchProb(BPI->getEdgeProbability(BB, Succ))))
-        // Irreducible backedge.
-        return false;
+    for (auto SuccI = GraphTraits<const BlockT *>::child_begin(BB),
+              SuccE = GraphTraits<const BlockT *>::child_end(BB);
+         SuccI != SuccE;
+         ++SuccI)
+      if (!addToDist(Dist, OuterLoop, Node, getNode(*SuccI),
+        getWeightFromBranchProb(BPI->getEdgeProbability(BB, SuccI))))
+          // Irreducible backedge.
+          return false;
   }
 
   // Distribute mass to successors, saving exit and backedge data in the


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D40891.125823.patch
Type: text/x-patch
Size: 1035 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171206/aedb48dc/attachment.bin>


More information about the llvm-commits mailing list