... |
... |
@@ -1465,7 +1465,7 @@ preInlineUnconditionally env top_lvl bndr rhs rhs_env |
1465
|
1465
|
, occ_in_lam = NotInsideLam
|
1466
|
1466
|
, occ_int_cxt = int_cxt }
|
1467
|
1467
|
= isNotTopLevel top_lvl -- Get rid of allocation
|
1468
|
|
- || (int_cxt==IsInteresting) -- Function is applied
|
|
1468
|
+ || (int_cxt==IsInteresting && idArity bndr > 0) -- Function is applied
|
1469
|
1469
|
-- || (early_phase && not (isConLikeUnfolding unf)) -- See early_phase
|
1470
|
1470
|
one_occ OneOcc{ occ_n_br = 1
|
1471
|
1471
|
, occ_in_lam = IsInsideLam
|
... |
... |
@@ -1632,6 +1632,7 @@ postInlineUnconditionally env bind_cxt old_bndr bndr rhs |
1632
|
1632
|
unfolding = idUnfolding bndr
|
1633
|
1633
|
-- arity = idArity bndr
|
1634
|
1634
|
is_cheap = isCheapUnfolding unfolding
|
|
1635
|
+ is_exp = isExpandableUnfolding unfolding
|
1635
|
1636
|
uf_opts = seUnfoldingOpts env
|
1636
|
1637
|
phase = sePhase env
|
1637
|
1638
|
active = isActive phase (idInlineActivation bndr)
|
... |
... |
@@ -1639,6 +1640,8 @@ postInlineUnconditionally env bind_cxt old_bndr bndr rhs |
1639
|
1640
|
|
1640
|
1641
|
-- Check for code-size blow-up from inlining in multiple places
|
1641
|
1642
|
code_dup_ok n_br
|
|
1643
|
+ | is_top_lvl -- Don't inline top-level datacons, ever; no advantage,
|
|
1644
|
+ , is_exp = False -- and float-out may have carefully created them
|
1642
|
1645
|
| n_br == 1 = True -- No duplication
|
1643
|
1646
|
| n_br >= 100 = False -- See #23627
|
1644
|
1647
|
| is_demanded = False -- Demanded => no allocation (it'll be a case expression
|