Simon Peyton Jones pushed to branch wip/T23109a at Glasgow Haskell Compiler / GHC
Commits:
-
ef3ab33f
by Simon Peyton Jones at 2025-04-21T22:38:03+01:00
1 changed file:
Changes:
... | ... | @@ -1632,7 +1632,8 @@ postInlineUnconditionally env bind_cxt old_bndr bndr rhs |
1632 | 1632 | is_demanded = isStrUsedDmd (idDemandInfo bndr)
|
1633 | 1633 | occ_info = idOccInfo old_bndr
|
1634 | 1634 | unfolding = idUnfolding bndr
|
1635 | - is_cheap = isCheapUnfolding unfolding
|
|
1635 | + arity = idArity bndr
|
|
1636 | +-- is_cheap = isCheapUnfolding unfolding
|
|
1636 | 1637 | uf_opts = seUnfoldingOpts env
|
1637 | 1638 | phase = sePhase env
|
1638 | 1639 | active = isActive phase (idInlineActivation bndr)
|
... | ... | @@ -1650,10 +1651,10 @@ postInlineUnconditionally env bind_cxt old_bndr bndr rhs |
1650 | 1651 | check_one_occ NotInsideLam NotInteresting n_br = not is_top_lvl && code_dup_ok n_br
|
1651 | 1652 | check_one_occ NotInsideLam IsInteresting n_br = code_dup_ok n_br
|
1652 | 1653 | check_one_occ IsInsideLam NotInteresting _ = False
|
1653 | - check_one_occ IsInsideLam IsInteresting n_br = is_cheap && code_dup_ok n_br
|
|
1654 | + check_one_occ IsInsideLam IsInteresting n_br = arity > 0 && code_dup_ok n_br
|
|
1654 | 1655 | -- IsInteresting: inlining inside a lambda only with good reason
|
1655 | 1656 | -- See the notes on int_cxt in preInlineUnconditionally
|
1656 | - -- is_cheap: check for acceptable work duplication, using isCheapUnfolding
|
|
1657 | + -- arity>0: do not inline data strutures under lambdas, only functions
|
|
1657 | 1658 | |
1658 | 1659 | ---------------
|
1659 | 1660 | -- A wrong bit of code, left here in case you are tempted to do this
|