[GHC] #14137: Do more inlining into non-recursive join points

GHC ghc-devs at haskell.org
Wed Aug 23 14:47:11 UTC 2017


#14137: Do more inlining into non-recursive join points
-------------------------------------+-------------------------------------
        Reporter:  simonpj           |                Owner:  nomeata
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.2.1
      Resolution:                    |             Keywords:  JoinPoints
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 simonpj):

 Consider the example above:
 {{{
 let ys = expensive in
 letrec f xs = case xs of
                []     -> ys
                (p:ps) -> p : f ps
 in f ps : qs
 }}}
 Here `f` is called exactly once in the body of the `letrec`, but not in
 tail position.

 Question: can cardinality analysis discover that `ys` is evaluated at most
 once?  I would have thought the answer should be 'yes'.  And if so, we can
 inline it, which is what we want.  To make this go
  * We'd need to check that the cardinality analysis fixpoint stuff was up
 to snuff
  * We'd need to make the inliner take account of that used-once info.

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


More information about the ghc-tickets mailing list