Skip to content

Commit

Permalink
Slight improvement in WorkWrap
Browse files Browse the repository at this point in the history
Ensure that WorkWrap preserves lambda binders, in case of join points.  Sadly I
have forgotten why I made this change (it was while I was doing a lot of
meddling in the Simplifier, but
  * it does no harm,
  * it is slightly more efficient, and
  * presumably it made something better!

Anyway I have kept it in a separate commit.
  • Loading branch information
simonpj authored and Marge Bot committed Apr 3, 2024
1 parent 609cd32 commit ae24c9b
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions compiler/GHC/Core/Opt/WorkWrap.hs
Original file line number Diff line number Diff line change
Expand Up @@ -768,11 +768,19 @@ splitFun ww_opts fn_id rhs
return [(fn_id, rhs)]

Just stuff
| let opt_wwd_rhs = simpleOptExpr (wo_simple_opts ww_opts) rhs
-- We need to stabilise the WW'd (and optimised) RHS below
| let opt_wwd_rhs = mkLams arg_vars $
simpleOptExpr (wo_simple_opts ww_opts) body
-- Run the simple optimiser on the WW'd body, to get rid of
-- junk. Keep all the original `arg_vars` binders though: this
-- might be a join point, and we don't want to lose the
-- one-shot annotations. At least I think that's the reason
-- (honestly, I have forgottne), but doing it this way
-- certainly does no harm and is slightly more efficient.

, Just stable_unf <- certainlyWillInline uf_opts fn_info opt_wwd_rhs
-- We could make a w/w split, but in fact the RHS is small
-- See Note [Don't w/w inline small non-loop-breaker things]

, let id_w_unf = fn_id `setIdUnfolding` stable_unf
-- See Note [Inline pragma for certainlyWillInline]
-> return [ (id_w_unf, rhs) ]
Expand Down

0 comments on commit ae24c9b

Please sign in to comment.