[Git][ghc/ghc][wip/T23109a] Tiny change to saves_alloc

Simon Peyton Jones pushed to branch wip/T23109a at Glasgow Haskell Compiler / GHC Commits: ce5db8f6 by Simon Peyton Jones at 2025-04-24T11:39:08+01:00 Tiny change to saves_alloc Float lambdas (and PAPs) out of lambdas to top level This improves spectral/cse But the old comment was -- is_con_app: don't float PAPs to the top; they may well end -- up getting eta-expanded and re-inlined -- E.g. f = \x -> (++) ys -- If we float, then eta-expand we get -- lvl = (++) ys -- f = \x \zs -> lvl zs -- and now we'll inline lvl. Silly. Let's see what CI says - - - - - 1 changed file: - compiler/GHC/Core/Opt/SetLevels.hs Changes: ===================================== compiler/GHC/Core/Opt/SetLevels.hs ===================================== @@ -707,12 +707,12 @@ lvlMFE env strict_ctxt ann_expr escapes_value_lam = dest_lvl `ltMajLvl` (le_ctxt_lvl env) -- See Note [Floating to the top] - is_con_app = isSaturatedConApp expr -- True of literal strings too +-- is_con_app = isSaturatedConApp expr -- True of literal strings too saves_alloc = isTopLvl dest_lvl && (escapes_value_lam || floatConsts env) -- Always float allocation out of a value lambda -- if it gets to top level - && (not strict_ctxt || is_con_app || is_bot_lam) + && (not strict_ctxt || is_hnf || is_bot_lam) -- is_con_app: don't float PAPs to the top; they may well end -- up getting eta-expanded and re-inlined -- E.g. f = \x -> (++) ys View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/ce5db8f652b48a613e55d0738bcc7aa3... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/ce5db8f652b48a613e55d0738bcc7aa3... You're receiving this email because of your account on gitlab.haskell.org.
participants (1)
-
Simon Peyton Jones (@simonpj)