[commit: ghc] master: Preserve specialisations despite CSE (3addf72)

git at git.haskell.org git at git.haskell.org
Wed Sep 5 16:26:43 UTC 2018


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

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

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

commit 3addf72a6f40747cff213653382eb4476bdb53da
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Wed Sep 5 15:54:48 2018 +0100

    Preserve specialisations despite CSE
    
    Trac #15445 showed that, as a result of CSE, a function with an
    automatically generated specialisation RULE could be inlined
    before the RULE had a chance to fire.
    
    This patch attaches a NOINLINE[2] activation to the Id, during
    CSE, to stop this happening.
    
    See Note [Delay inlining after CSE]
    
    ---- Historical note ---
    
    This patch is simpler and more direct than an earlier
    version:
    
      commit 2110738b280543698407924a16ac92b6d804dc36
      Author: Simon Peyton Jones <simonpj at microsoft.com>
      Date:   Mon Jul 30 13:43:56 2018 +0100
    
      Don't inline functions with RULES too early
    
    We had to revert this patch because it made GHC itself slower.
    
    Why? It delayed inlining of /all/ functions with RULES, and that was
    very bad in TcFlatten.flatten_ty_con_app
    
    * It delayed inlining of liftM
    * That delayed the unravelling of the recursion in some dictionary
      bindings.
    * That delayed some eta expansion, leaving
         flatten_ty_con_app = \x y. let <stuff> in \z. blah
    * That allowed the float-out pass to put sguff between
      the \y and \z.
    * And that permanently stopped eta expasion of the function,
      even once <stuff> was simplified.
    
    -- End of historical note ---


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

3addf72a6f40747cff213653382eb4476bdb53da
 compiler/simplCore/CSE.hs                          | 68 ++++++++++++++++++----
 .../tests/numeric/should_compile/T14465.stdout     |  2 +-
 .../tests/numeric/should_compile/T7116.stdout      |  4 +-
 testsuite/tests/simplCore/should_compile/T15445.hs |  8 +++
 .../tests/simplCore/should_compile/T15445.stderr   | 13 +++++
 .../tests/simplCore/should_compile/T15445a.hs      | 10 ++++
 testsuite/tests/simplCore/should_compile/all.T     |  4 +-
 7 files changed, 94 insertions(+), 15 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 3addf72a6f40747cff213653382eb4476bdb53da


More information about the ghc-commits mailing list