[GHC] #14137: Do more inlining into non-recursive join points
GHC
ghc-devs at haskell.org
Wed Aug 23 21:53:59 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 nomeata):
That example is what #10918 is about. The Cardinality Analyser does not
see that `ys` is evaluated at most once, but Call Arity does. We can make
it inline, but the tricky bit is to prevent it from being floated out
again. That’s what I feel that a `call` to a join point outside of
`letrec` would be more explicit and more stable – although I see the
clumsiness of that. There you write:
> But it does seem hard. The float-out pass assumes, crudely, that it's
good to float out a redex of any called-many lambda. But, as we see here,
that's wrong for case branches that are only evaluated on one of those
calls (the final one in this case). Not only is that info hard to record
in the syntax tree, but it's also potentially quite fragile to program
transformation, like other sorts of cardinality information.
And a `call` to a join-point outside the `letrec` is so far the only way I
can think of to “record it in the syntax tree” – but maybe there are
better ways?
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14137#comment:16>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list