[GHC] #9320: Inlining regression/strangeness in 7.8

GHC ghc-devs at haskell.org
Fri Jul 18 23:11:13 UTC 2014


#9320: Inlining regression/strangeness in 7.8
-------------------------------------+-------------------------------------
              Reporter:  dolio       |             Owner:
                  Type:  bug         |            Status:  new
              Priority:  normal      |         Milestone:
             Component:  Compiler    |           Version:  7.8.2
            Resolution:              |          Keywords:
Differential Revisions:              |  Operating System:  Unknown/Multiple
          Architecture:              |   Type of failure:  Runtime
  Unknown/Multiple                   |  performance bug
            Difficulty:  Unknown     |         Test Case:
            Blocked By:              |          Blocking:
       Related Tickets:              |
-------------------------------------+-------------------------------------

Comment (by simonpj):

 Are you certain that this ever worked, in any version of GHC?

 What's happening is that we see
 {{{
 test0 = /\s. \n v. test @ Data.Vector.Unboxed.Base.MVector
                         @ (GHC.ST.ST s)
                         @ GHC.Types.Int
                        ($dPrimMonad_s1Mw @ s)
                        ...
 }}}
 We run over the program gathering up specialised cals to `test`, but this
 one is discarded again because the `/\s` means that the `s` type variable
 in the call isn't visible at top level.

 To fix this we need to make the specialiser a bit cleverer, so that it'll
 generate a RULE like
 {{{
 RULE forall s (d:forall s. PrimMonad (ST s)).
   test @ MVector @ (ST s) @ Int (d @ s)
      = $stest s
 }}}
 with accompanying definition
 {{{
 $stest = /\s. <body-of-test> @ MVector @ (ST s) @ Int ($dPrimMonad_s1Mw @
 s)
 }}}
 GHC has never done this.  It could do, but it's a new thing.

 Simon

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


More information about the ghc-tickets mailing list