[GHC] #14844: SpecConstr also non-recursive function

GHC ghc-devs at haskell.org
Tue Mar 20 14:01:22 UTC 2018


#14844: SpecConstr also non-recursive function
-------------------------------------+-------------------------------------
        Reporter:  nomeata           |                Owner:  (none)
            Type:  task              |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.5
      Resolution:                    |             Keywords:  SpecConstr
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by nomeata):

 So here is an idea that might help here, and that I want to run past
 people who know !SpecConstr well (is that anyone else but SPJ at this
 point?).

 Status quo: `l` gets specialized, because of the two call patterns `s' t0`
 and `(s-1) (x,y)`, the second one is interesting *and* its second argument
 gets scrutinized (the `scu_occs` field reports `ScrutOcc` for `t`). But
 `foo` does not get specialized: It does have an interesting call pattern,
 but `scu_occs` reports `UnkOcc`, because `foo`’s parameters are just
 passed to `t`.

 But: When we decide to !SpecConstr `l`, we know that one of the calls to
 to `l` is of the shape `s' t0`. This is a boring call, and we do not
 create a specialization for it. But we create a specialization for `l`
 using the the other call pattern. This means we know that it would be
 beneficial if `t0` were a constructor. So can we, at this point, decide to
 include `t0 ↦ ScrutOcc` in `scu_occs`?

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


More information about the ghc-tickets mailing list