[Git][ghc/ghc][wip/romes/25170-idea4] More WIP [skip ci]
Simon Peyton Jones (@simonpj)
gitlab at gitlab.haskell.org
Wed Mar 12 17:42:07 UTC 2025
Simon Peyton Jones pushed to branch wip/romes/25170-idea4 at Glasgow Haskell Compiler / GHC
Commits:
b86769ca by Simon Peyton Jones at 2025-03-12T17:41:46+00:00
More WIP [skip ci]
- - - - -
2 changed files:
- compiler/GHC/Core/Opt/Simplify/Iteration.hs
- compiler/GHC/Core/Opt/Simplify/Utils.hs
Changes:
=====================================
compiler/GHC/Core/Opt/Simplify/Iteration.hs
=====================================
@@ -69,6 +69,7 @@ import GHC.Utils.Misc
import Control.Monad
import Data.List.NonEmpty (NonEmpty (..))
+import Data.Maybe
{-
The guts of the simplifier is in this module, but the driver loop for
@@ -1827,7 +1828,8 @@ simpl_lam env bndr body (ApplyToVal { sc_arg = arg, sc_env = arg_se
-- It's wrong to err in either direction
-- But fun_ty is an OutType, so is fully substituted
- ; if | Just env' <- preInlineUnconditionally env NotTopLevel bndr arg arg_se
+ ; if | Just env' <- let res = preInlineUnconditionally env NotTopLevel bndr arg arg_se
+ in pprTrace "simpl_lam" (ppr arg $$ ppr (isJust res)) res
, not (needsCaseBindingL arg_levity arg)
, not ( isSimplified dup &&
not (exprIsTrivial arg) &&
@@ -1838,7 +1840,8 @@ simpl_lam env bndr body (ApplyToVal { sc_arg = arg, sc_env = arg_se
tick (PreInlineUnconditionally bndr)
; simplLam env' body cont }
- | isSimplified dup -- Don't re-simplify if we've simplified it once
+ | pprTrace "simpl_lam2" (ppr arg) $
+ isSimplified dup -- Don't re-simplify if we've simplified it once
-- Including don't preInlineUnconditionally
-- See Note [Avoiding simplifying repeatedly]
-> completeBindX env from_what bndr arg body cont
@@ -2452,8 +2455,11 @@ rebuildCall env (ArgInfo { ai_fun = fun, ai_args = rev_args, ai_rules = rules })
| null rules
= rebuild env (argInfoExpr fun rev_args) cont
| otherwise -- Try rules again
- = do { let args = argInfoAppArgs rev_args
- ; mb_match <- tryRules env rules run args
+ = do { let full_cont = pushSimplifiedRevArgs env rev_args cont
+ ; mb_match <- tryRules env rules fun full_cont
+ ; case mb_match of
+ Just (rhs, cont2) -> simplExprF env rhs cont2
+ Nothing -> rebuild env (argInfoExpr fun rev_args) cont }
-----------------------------------
tryInlining :: SimplEnv -> Logger -> OutId -> SimplCont -> SimplM (Maybe OutExpr)
@@ -4030,7 +4036,7 @@ mkDupableStrictBind env arg_bndr join_rhs res_ty
| otherwise
= do { join_bndr <- newJoinId [arg_bndr] res_ty
; let arg_info = ArgInfo { ai_fun = join_bndr
- , ai_rewrite = TryNothing, ai_args = []
+ , ai_rules = [], ai_args = []
, ai_encl = False, ai_dmds = repeat topDmd
, ai_discs = repeat 0 }
; return ( addJoinFloats (emptyFloats env) $
=====================================
compiler/GHC/Core/Opt/Simplify/Utils.hs
=====================================
@@ -284,7 +284,7 @@ instance Outputable SimplCont where
= (text "ApplyToTy" <+> pprParendType ty) $$ ppr cont
ppr (ApplyToVal { sc_arg = arg, sc_dup = dup, sc_cont = cont, sc_hole_ty = hole_ty, sc_env = env })
= (hang (text "ApplyToVal" <+> ppr dup <+> text "hole-ty:" <+> pprParendType hole_ty)
- 2 (ppr (seIdSubst env) $$ pprParendExpr arg))
+ 2 (pprParendExpr arg))
$$ ppr cont
ppr (StrictBind { sc_bndr = b, sc_cont = cont })
= (text "StrictBind" <+> ppr b) $$ ppr cont
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/b86769ca5f000aa4b7d9f79f6134defb3ef47dc5
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/b86769ca5f000aa4b7d9f79f6134defb3ef47dc5
You're receiving this email because of your account on gitlab.haskell.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20250312/4dede05a/attachment-0001.html>
More information about the ghc-commits
mailing list