[commit: ghc] master: Hoopl: improve postorder calculation (bbcea13)

git at git.haskell.org git at git.haskell.org
Mon Mar 19 16:38:43 UTC 2018


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/bbcea13af845d41a9d51a932476eb841ba182ea5/ghc

>---------------------------------------------------------------

commit bbcea13af845d41a9d51a932476eb841ba182ea5
Author: Michal Terepeta <michal.terepeta at gmail.com>
Date:   Mon Mar 19 11:58:54 2018 -0400

    Hoopl: improve postorder calculation
    
    - Fix the naming and comments to indicate that we are calculating
      *reverse* postorder (and not the standard postorder).
    
    - Rewrite the calculation to avoid CPS code. I found it fairly
      difficult to understand and the new one seems faster (according to
      nofib, decreases compiler allocations by 0.2%)
    
    - Remove `LabelsPtr`, which seems unnecessary and could be *really*
      confusing. For instance, previously:
      `postorder_dfs_from <block with label X>`
      and
      `postorder_dfs_from <label X>`
      would actually mean quite different things (and give different
      results).
    
    - Change the `Dataflow` module to always use entry of the graph for
      reverse postorder calculation. This should be the only change in
      behavior of this commit.
    
      Previously, if the caller provided initial facts for some of the
      labels, we would use those labels for our postorder calculation.
      However, I don't think that's correct in general - if the initial
      facts did not contain the entry of the graph, we would never analyze
      the blocks reachable from the entry but unreachable from the labels
      provided with the initial facts. It seems that the only analysis that
      used this was proc-point analysis, which I think would always include
      the entry block (so I don't think there's any bug due to this).
    
    Signed-off-by: Michal Terepeta <michal.terepeta at gmail.com>
    
    Test Plan: ./validate
    
    Reviewers: bgamari, simonmar
    
    Reviewed By: simonmar
    
    Subscribers: rwbarton, thomie, carter
    
    Differential Revision: https://phabricator.haskell.org/D4464


>---------------------------------------------------------------

bbcea13af845d41a9d51a932476eb841ba182ea5
 compiler/cmm/CmmCommonBlockElim.hs                 |   4 +-
 compiler/cmm/CmmContFlowOpt.hs                     |   9 +-
 compiler/cmm/CmmLayoutStack.hs                     |   2 +-
 compiler/cmm/CmmProcPoint.hs                       |   6 +-
 compiler/cmm/CmmSink.hs                            |   2 +-
 compiler/cmm/CmmUtils.hs                           |   7 +-
 compiler/cmm/Hoopl/Dataflow.hs                     |  29 ++---
 compiler/cmm/Hoopl/Graph.hs                        | 118 +++++++++------------
 compiler/cmm/PprCmm.hs                             |   4 +-
 testsuite/tests/{ado => cmm}/Makefile              |   0
 testsuite/tests/cmm/should_run/HooplPostorder.hs   |  69 ++++++++++++
 .../tests/cmm/should_run/HooplPostorder.stdout     |   4 +
 .../should_compile => cmm/should_run}/Makefile     |   0
 testsuite/tests/cmm/should_run/all.T               |   4 +
 14 files changed, 156 insertions(+), 102 deletions(-)

Diff suppressed because of size. To see it, use:

    git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc bbcea13af845d41a9d51a932476eb841ba182ea5


More information about the ghc-commits mailing list