[Git][ghc/ghc][wip/T23109a] Small wibbles

Simon Peyton Jones pushed to branch wip/T23109a at Glasgow Haskell Compiler / GHC Commits: 448a7bbc by Simon Peyton Jones at 2025-04-22T09:53:44+01:00 Small wibbles Don't make error calls interesting. Literals say True too isSaturatedConApp - - - - - 4 changed files: - compiler/GHC/Core/Opt/OccurAnal.hs - compiler/GHC/Core/Opt/SetLevels.hs - compiler/GHC/Core/Opt/Simplify/Utils.hs - compiler/GHC/Core/Utils.hs Changes: ===================================== compiler/GHC/Core/Opt/OccurAnal.hs ===================================== @@ -2580,8 +2580,9 @@ occAnalArgs !env fun args !one_shots -- Make bottoming functions interesting -- See Note [Bottoming function calls] - encl | Var f <- fun, isDeadEndSig (idDmdSig f) = OccScrut - | otherwise = OccVanilla +-- encl | Var f <- fun, isDeadEndSig (idDmdSig f) = OccScrut +-- | otherwise = OccVanilla + encl = OccVanilla go uds fun [] _ = WUD uds fun go uds fun (arg:args) one_shots @@ -2617,6 +2618,9 @@ setting occ_encl = OccScrut for such calls. The slightly-artificial test T21128 is a good example. It's probably not a huge deal. +ToDo!!! Fix comment. Now postinlineUnconditionally ignores intersting-ness for +non-top-level things. + Note [Arguments of let-bound constructors] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Consider ===================================== compiler/GHC/Core/Opt/SetLevels.hs ===================================== @@ -707,7 +707,7 @@ 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 + 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 @@ -719,7 +719,7 @@ lvlMFE env strict_ctxt ann_expr -- If we float, then eta-expand we get -- lvl = (++) ys -- f = \x \zs -> lvl zs - -- and now wei'll inline lvl. Silly. + -- and now we'll inline lvl. Silly. hasFreeJoin :: LevelEnv -> DVarSet -> Bool ===================================== compiler/GHC/Core/Opt/Simplify/Utils.hs ===================================== @@ -1619,8 +1619,6 @@ postInlineUnconditionally env bind_cxt old_bndr bndr rhs OneOcc { occ_in_lam = in_lam, occ_int_cxt = int_cxt, occ_n_br = n_br } | exprIsTrivial rhs -> True --- | is_top_lvl -> False --- Inlining a top-level used-once function is good | otherwise -> check_one_occ in_lam int_cxt n_br IAmDead -> True -- This happens; for example, the case_bndr during case of ===================================== compiler/GHC/Core/Utils.hs ===================================== @@ -397,10 +397,12 @@ mkTicks :: [CoreTickish] -> CoreExpr -> CoreExpr mkTicks ticks expr = foldr mkTick expr ticks isSaturatedConApp :: CoreExpr -> Bool +-- Also includes literals isSaturatedConApp e = go e [] where go (App f a) as = go f (a:as) go (Var fun) args = isConLikeId fun && idArity fun == valArgCount args + go (Lit {}) _ = True go (Cast f _) as = go f as go _ _ = False View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/448a7bbcc48acb64a75622786711ab7d... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/448a7bbcc48acb64a75622786711ab7d... You're receiving this email because of your account on gitlab.haskell.org.
participants (1)
-
Simon Peyton Jones (@simonpj)