[Git][ghc/ghc][wip/T23109] Slight improvement to pre/postInlineUnconditionally

Simon Peyton Jones pushed to branch wip/T23109 at Glasgow Haskell Compiler / GHC Commits: b0ceb856 by Simon Peyton Jones at 2025-06-25T12:47:37+01:00 Slight improvement to pre/postInlineUnconditionally Avoids an extra simplifier iteration - - - - - 1 changed file: - compiler/GHC/Core/Opt/Simplify/Utils.hs Changes: ===================================== compiler/GHC/Core/Opt/Simplify/Utils.hs ===================================== @@ -1494,6 +1494,7 @@ preInlineUnconditionally env top_lvl bndr rhs rhs_env -- so substituting rhs inside a lambda doesn't change the occ info. -- Sadly, not quite the same as exprIsHNF. canInlineInLam (Lit _) = True + canInlineInLam (Cast e _) = canInlineInLam e canInlineInLam (Lam b e) = isRuntimeVar b || canInlineInLam e canInlineInLam (Tick t e) = not (tickishIsCode t) && canInlineInLam e canInlineInLam (Var v) = case idOccInfo v of @@ -1612,7 +1613,7 @@ postInlineUnconditionally env bind_cxt old_bndr bndr rhs -- so inlining duplicates code but nothing more | otherwise - -> work_ok in_lam int_cxt && smallEnoughToInline uf_opts unfolding + -> work_ok in_lam int_cxt && (n_br == 1 || smallEnoughToInline uf_opts unfolding) -- Multiple syntactic occurences; but lazy, and small enough to dup -- ToDo: consider discount on smallEnoughToInline if int_cxt is true View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/b0ceb8566e4d2c8817e5b556cf2a9386... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/b0ceb8566e4d2c8817e5b556cf2a9386... You're receiving this email because of your account on gitlab.haskell.org.
participants (1)
-
Simon Peyton Jones (@simonpj)