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
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:
... | ... | @@ -2580,8 +2580,9 @@ occAnalArgs !env fun args !one_shots |
2580 | 2580 | |
2581 | 2581 | -- Make bottoming functions interesting
|
2582 | 2582 | -- See Note [Bottoming function calls]
|
2583 | - encl | Var f <- fun, isDeadEndSig (idDmdSig f) = OccScrut
|
|
2584 | - | otherwise = OccVanilla
|
|
2583 | +-- encl | Var f <- fun, isDeadEndSig (idDmdSig f) = OccScrut
|
|
2584 | +-- | otherwise = OccVanilla
|
|
2585 | + encl = OccVanilla
|
|
2585 | 2586 | |
2586 | 2587 | go uds fun [] _ = WUD uds fun
|
2587 | 2588 | go uds fun (arg:args) one_shots
|
... | ... | @@ -2617,6 +2618,9 @@ setting occ_encl = OccScrut for such calls. |
2617 | 2618 | The slightly-artificial test T21128 is a good example. It's probably
|
2618 | 2619 | not a huge deal.
|
2619 | 2620 | |
2621 | +ToDo!!! Fix comment. Now postinlineUnconditionally ignores intersting-ness for
|
|
2622 | +non-top-level things.
|
|
2623 | + |
|
2620 | 2624 | Note [Arguments of let-bound constructors]
|
2621 | 2625 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
2622 | 2626 | Consider
|
... | ... | @@ -707,7 +707,7 @@ lvlMFE env strict_ctxt ann_expr |
707 | 707 | escapes_value_lam = dest_lvl `ltMajLvl` (le_ctxt_lvl env)
|
708 | 708 | |
709 | 709 | -- See Note [Floating to the top]
|
710 | - is_con_app = isSaturatedConApp expr
|
|
710 | + is_con_app = isSaturatedConApp expr -- True of literal strings too
|
|
711 | 711 | saves_alloc = isTopLvl dest_lvl
|
712 | 712 | && (escapes_value_lam || floatConsts env)
|
713 | 713 | -- Always float allocation out of a value lambda
|
... | ... | @@ -719,7 +719,7 @@ lvlMFE env strict_ctxt ann_expr |
719 | 719 | -- If we float, then eta-expand we get
|
720 | 720 | -- lvl = (++) ys
|
721 | 721 | -- f = \x \zs -> lvl zs
|
722 | - -- and now wei'll inline lvl. Silly.
|
|
722 | + -- and now we'll inline lvl. Silly.
|
|
723 | 723 | |
724 | 724 | |
725 | 725 | hasFreeJoin :: LevelEnv -> DVarSet -> Bool
|
... | ... | @@ -1619,8 +1619,6 @@ postInlineUnconditionally env bind_cxt old_bndr bndr rhs |
1619 | 1619 | |
1620 | 1620 | OneOcc { occ_in_lam = in_lam, occ_int_cxt = int_cxt, occ_n_br = n_br }
|
1621 | 1621 | | exprIsTrivial rhs -> True
|
1622 | --- | is_top_lvl -> False
|
|
1623 | --- Inlining a top-level used-once function is good
|
|
1624 | 1622 | | otherwise -> check_one_occ in_lam int_cxt n_br
|
1625 | 1623 | |
1626 | 1624 | IAmDead -> True -- This happens; for example, the case_bndr during case of
|
... | ... | @@ -397,10 +397,12 @@ mkTicks :: [CoreTickish] -> CoreExpr -> CoreExpr |
397 | 397 | mkTicks ticks expr = foldr mkTick expr ticks
|
398 | 398 | |
399 | 399 | isSaturatedConApp :: CoreExpr -> Bool
|
400 | +-- Also includes literals
|
|
400 | 401 | isSaturatedConApp e = go e []
|
401 | 402 | where go (App f a) as = go f (a:as)
|
402 | 403 | go (Var fun) args
|
403 | 404 | = isConLikeId fun && idArity fun == valArgCount args
|
405 | + go (Lit {}) _ = True
|
|
404 | 406 | go (Cast f _) as = go f as
|
405 | 407 | go _ _ = False
|
406 | 408 |