This is an archive of the discontinued LLVM Phabricator instance.

[WIP!][DomTreeUpdater-Auto[1]] Collect DomTree construction/update statistics and timing data
AbandonedPublic

Authored by NutshellySima on Aug 5 2018, 3:49 AM.

Details

Reviewers
kuhar
Summary

Note: This is a work-in-progress patch and I don't intend to commit it.

This patch has the same intention with D50300. But it targets the Auto[1] UpdateStrategy presented in D50302.

This patch measures the performance of DomTree updating by counting via Statistics the number of no-ops/invalid updates removed, the number of lazy updates applied, the number of recalculation requested via the DomTreeUpdater interface.

This patch also provide timing data through the Timer and TimerGroup class in the LLVM codebase. I put the Timer of DominatorTree in the DomTreeUpdater.cpp because the Timer needs to be static and can only be initialized once so it cannot be in a header file. The unittests failed by this patch is because of some part of LLVM (e.g. lto2) is multithreaded.

Example data collected:

$ opt -passes="default<O3>" -stats < ./sqlite.bc > /dev/null
Statistics
    3 DTU-stats                    - Number of invalid updates discarded
 7058 DTU-stats                    - Number of lazy updates applied
 2541 DTU-stats                    - Number of no-ops removed
    3 DTU-stats                    - Number of recalculations requested
===-------------------------------------------------------------------------===
                                   DTU timing
===-------------------------------------------------------------------------===
  Total Execution Time: 0.0228 seconds (0.0230 wall clock)

   ---User Time---   --System Time--   --User+System--   ---Wall Time---  --- Name ---
   0.0223 ( 98.3%)   0.0001 ( 97.2%)   0.0224 ( 98.3%)   0.0227 ( 98.4%)  apply-updates -- DomTree
   0.0003 (  1.4%)   0.0000 (  2.8%)   0.0003 (  1.5%)   0.0003 (  1.3%)  apply-updates -- PostDomTree
   0.0000 (  0.1%)   0.0000 (  0.0%)   0.0000 (  0.1%)   0.0000 (  0.2%)  delete-edge -- DomTree
   0.0000 (  0.1%)   0.0000 (  0.0%)   0.0000 (  0.1%)   0.0000 (  0.1%)  insert-edge -- DomTree
   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0000 (  0.0%)  recalculate -- DomTree
   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0000 (  0.0%)  delete-edge -- PostDomTree
   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0000 (  0.0%)  insert-edge -- PostDomTree
   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0000 (  0.0%)  recalculate -- PostDomTree
   0.0227 (100.0%)   0.0001 (100.0%)   0.0228 (100.0%)   0.0230 (100.0%)  Total

===-------------------------------------------------------------------------===
                              DomTree Calculation
===-------------------------------------------------------------------------===
  Total Execution Time: 0.1437 seconds (0.1458 wall clock)

   ---User Time---   --System Time--   --User+System--   ---Wall Time---  --- Name ---
   0.0899 ( 63.4%)   0.0017 ( 88.4%)   0.0916 ( 63.8%)   0.0931 ( 63.9%)  recalculate -- DomTree
   0.0406 ( 28.6%)   0.0002 (  8.0%)   0.0408 ( 28.4%)   0.0409 ( 28.0%)  apply-updates -- DomTree
   0.0110 (  7.8%)   0.0001 (  3.4%)   0.0111 (  7.7%)   0.0116 (  8.0%)  recalculate -- PostDomTree
   0.0002 (  0.1%)   0.0000 (  0.2%)   0.0002 (  0.1%)   0.0002 (  0.1%)  delete-edge -- DomTree
   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0000 (  0.0%)  insert-edge -- DomTree
   0.1417 (100.0%)   0.0019 (100.0%)   0.1437 (100.0%)   0.1458 (100.0%)  Total

Diff Detail