[GHC] #15090: Do more coercion optimisation on the fly

GHC ghc-devs at haskell.org
Thu Apr 26 14:09:21 UTC 2018


#15090: Do more coercion optimisation on the fly
-------------------------------------+-------------------------------------
           Reporter:  simonpj        |             Owner:  (none)
               Type:  task           |            Status:  new
           Priority:  normal         |         Milestone:  8.6.1
          Component:  Compiler       |           Version:  8.2.2
           Keywords:  Coercions      |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  Compile-time
  Unknown/Multiple                   |  performance bug
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 When studying #15019, I looked at `CoreOpt.pushCoValArg`.  I saw lots of
 attempted decompositions in `pushCoValArg`,
 which were trying to do `decomposeFunCo` on
 {{{
     C @g1 ; sym (C @g2)
 where
     axiom C a = a -> a
 }}}
 But the smart `mkNthCo` can't make progress on this, so we get
 {{{
    Nth:2 (C @g1 ; sym (C @g2))
 }}}
 and these things stack up if there is a chain of applications in
 `Simplify.simplCast`.

 The coercion optimiser will optimise this coercion to
 {{{
    (g1 ; sym g2) -> (g1 ; sym g2)
 }}}
 and now the smart `mkNthCo` in `decomposeFunCo` will succeed.

 Possible idea: make this optimization part of `mkTransCo` so that it
 happens on the fly.

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15090>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list