[commit: ghc] master: Fix the implementation of the "push rules" (b4f2afe)

git at git.haskell.org git at git.haskell.org
Fri Jan 6 10:52:53 UTC 2017


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

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

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

commit b4f2afe70ddbd0576b4eba3f82ba1ddc52e9b3bd
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Fri Jan 6 09:35:37 2017 +0000

    Fix the implementation of the "push rules"
    
    Richard pointed out (comment:12 of Trac #13025) that my
    implementation of the coercion "push rules", newly added
    in exprIsConAppMaybe by commit b4c3a66, wasn't quite right.
    
    But in fact that means that the implementation of those same
    rules in Simplify.simplCast was wrong too.
    
    Hence this commit:
    
    * Refactor the push rules so they are implemented in just
      one place (CoreSubst.pushCoArgs, pushCoTyArg, pushCoValArg)
      The code in Simplify gets simpler, which is nice.
    
    * Fix the bug that Richard pointed out (to do with hetero-kinded
      coercions)
    
    Then compiler performance worsened, which led mt do discover
    two performance bugs:
    
    * The smart constructor Coercion.mkNthCo didn't have a case
      for ForAllCos, which meant we stupidly build a complicated
      coercion where a simple one would do
    
    * In OptCoercion there was one place where we used CoherenceCo
      (the data constructor) rather than mkCoherenceCo (the smart
      constructor), which meant that the the stupid complicated
      coercion wasn't optimised away
    
    For reasons I don't fully understand, T5321Fun did 2% less compiler
    allocation after all this, which is good.


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

b4f2afe70ddbd0576b4eba3f82ba1ddc52e9b3bd
 compiler/coreSyn/CoreSubst.hs       | 259 +++++++++++++++++++++++-------------
 compiler/simplCore/Simplify.hs      |  84 ++++--------
 compiler/types/Coercion.hs          |   5 +-
 compiler/types/OptCoercion.hs       |   2 +-
 testsuite/tests/perf/compiler/all.T |   5 +-
 5 files changed, 202 insertions(+), 153 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 b4f2afe70ddbd0576b4eba3f82ba1ddc52e9b3bd


More information about the ghc-commits mailing list