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

Phabricator via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 25 18:31:47 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL345353: Teach the DominatorTree fallback to recalculation when applying updates to… (authored by sima, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D53245?vs=171112&id=171239#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D53245

Files:
  llvm/trunk/include/llvm/Support/GenericDomTreeConstruction.h


Index: llvm/trunk/include/llvm/Support/GenericDomTreeConstruction.h
===================================================================
--- llvm/trunk/include/llvm/Support/GenericDomTreeConstruction.h
+++ llvm/trunk/include/llvm/Support/GenericDomTreeConstruction.h
@@ -1191,6 +1191,20 @@
     });
     LLVM_DEBUG(dbgs() << "\n");
 
+    // Recalculate the DominatorTree when the number of updates
+    // exceeds a threshold, which usually 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 an acceptable performance on some real-world
+    // inputs.
+
+    // Make unittests of the incremental algorithm work
+    if (DT.DomTreeNodes.size() <= 100) {
+      if (NumLegalized > DT.DomTreeNodes.size())
+        CalculateFromScratch(DT, &BUI);
+    } else if (NumLegalized > DT.DomTreeNodes.size() / 40)
+      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.171239.patch
Type: text/x-patch
Size: 1160 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181026/8ea63de6/attachment.bin>


More information about the llvm-commits mailing list