[PATCH] D53245: Teach the DominatorTree fallback to recalculation when applying updates to speedup JT (PR37929)

Chijun Sima via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 14 07:25:36 PDT 2018


NutshellySima updated this revision to Diff 169600.
NutshellySima edited the summary of this revision.
NutshellySima added a comment.

Make the threshold selected proportional to the domtree size.


https://reviews.llvm.org/D53245

Files:
  include/llvm/Support/GenericDomTreeConstruction.h


Index: include/llvm/Support/GenericDomTreeConstruction.h
===================================================================
--- include/llvm/Support/GenericDomTreeConstruction.h
+++ include/llvm/Support/GenericDomTreeConstruction.h
@@ -1191,6 +1191,14 @@
     });
     LLVM_DEBUG(dbgs() << "\n");
 
+    // Recalculate the DominatorTree when the number of updates
+    // exceeds a threshold, which always makes direct updating slower than
+    // recalculation. We select this threshold proportional to the
+    // size of the DominatorTree. The constant is selected
+    // by choosing the one with the best performance on some real-world inputs.
+    if (NumLegalized > DT.DomTreeNodes.size() / 75)
+      CalculateFromScratch(DT, &BUI);
+
     // If the DominatorTree was recalculated at some point, stop the batch
     // updates. Full recalculations ignore batch updates and look at the actual
     // CFG.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53245.169600.patch
Type: text/x-patch
Size: 914 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181014/ce1ae0cd/attachment.bin>


More information about the llvm-commits mailing list