[commit: ghc] master: Kill off complications in CoreFVs (751996e)

git at git.haskell.org git at git.haskell.org
Wed Apr 12 15:16:40 UTC 2017


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

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

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

commit 751996e90a964026a3f86853338f10c82db6b610
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Fri Apr 7 17:10:07 2017 +0100

    Kill off complications in CoreFVs
    
    When doing type-in-type, Richard introduce some substantial
    complications in CoreFVs, gathering types and free variables
    of type.  In Trac #13160 we decided that this complication was
    unnecessary, so this patch removes it.
    
    Unfortnately I then fell down a twisty rabbit hole.  Roughly:
    
    * An apparently-innocuous change in the AnnApp case of
      fiExpr made the fuction a little bit stricter, so we ended
      up peering into the arguments when we didn't before (namely
      when there are no bindings being floated inwards).  I've
      rejigged it so that it's not fragile any more.
    
    * Peering into the arguments was sometimes expensive, becuase
      exprIsExpandable can be expensive because it looks deeply into
      the expression.
    
    * The combination of the two led to a non-linear explosion
      of work when the argument of a function is a deeep nest
      of constructors.  This bug has been lurking for ages.
    
      I solved it by replacing exprIsExpandable with exprIsHNF
      + exprIsTrivial; see Note [noFloatInto considerations]
    
    * The code around floating case-expressions turned out to be
      very delicate, because can_fail primops (which we want to
      float inwards) can't be floated outwards; so we have to be
      careful never to float them too far. Note [Floating primops]
      has the details
    
    * I ended up refactoring some rather opaque code in
      sepBindsByDropPoint.
    
    Working all this out meant that I rewrote quite a bit of
    code, so it's now a reasonably substantial patch.  But it's
    a net improvement.


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

751996e90a964026a3f86853338f10c82db6b610
 compiler/coreSyn/CoreFVs.hs   | 105 +++---------
 compiler/simplCore/FloatIn.hs | 369 ++++++++++++++++++++++++++----------------
 2 files changed, 255 insertions(+), 219 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 751996e90a964026a3f86853338f10c82db6b610


More information about the ghc-commits mailing list