Note [simple_app and join points]
In general for let-bindings we can do this:
(let { x = e } in b) a ==> let { x = e } in b a
But not for join points! For two reasons:
- We would need to push the continuation into the RHS:
(join { j = e } in b) a ==> let { j' = e a } in b[j'/j] a
NB ----^^
and also change the type of j, hence j'.
That's a bit sophisticated for the very simple optimiser.
- We might end up with something like
join { j' = e a } in
(case blah of )
( True -> j' void# ) a
( False -> blah )
and now the call to j' doesn't look like a tail call, and
Lint may reject. I say "may" because this is /explicitly/
allowed in the "Compiling without Continuations" paper
(Section 3, "Managing \Delta"). But GHC currently does not
allow this slightly-more-flexible form. See GHC.Core
Note [Join points are less general than the paper].
The simple thing to do is to disable this transformation
for join points in the simple optimiser References 1
Referenced by 1
- GHC.Core.SimpleOpt call site