[Git][ghc/ghc][wip/spj-unf-size] Adjust thresholds
Simon Peyton Jones (@simonpj)
gitlab at gitlab.haskell.org
Sun Nov 19 23:32:56 UTC 2023
Simon Peyton Jones pushed to branch wip/spj-unf-size at Glasgow Haskell Compiler / GHC
Commits:
ddd17134 by Simon Peyton Jones at 2023-11-19T23:32:16+00:00
Adjust thresholds
- - - - -
2 changed files:
- compiler/GHC/Core/Opt/Simplify/Inline.hs
- compiler/GHC/Core/Unfold.hs
Changes:
=====================================
compiler/GHC/Core/Opt/Simplify/Inline.hs
=====================================
@@ -660,10 +660,10 @@ exprDigest env e = go env e []
-- attract that ScrutOf discount! We want liftM2 to be inlined
-- in its use in the liftA2 method of instance Applicative (ST s)
--
- -- Actually in specrtal/puzzle I found that we got a big (40%!)
+ -- Actually in spectral/puzzle I found that we got a big (40%!)
-- benefit from let newDest = ... in case (notSeen newDest) of ...
-- We want to inline notSeen. The argument has structure (its RHS)
- -- and in fat if we inline notSeen, newDest turns into a thunk
+ -- and in fact if we inline notSeen, newDest turns into a thunk
-- (SPJ GHC log 13 Nov).
| Just rhs <- expandUnfolding_maybe unfolding
=====================================
compiler/GHC/Core/Unfold.hs
=====================================
@@ -206,7 +206,7 @@ defaultUnfoldingOpts = UnfoldingOpts
-- inline into Csg.calc (The unfolding for sqr never makes it
-- into the interface file.)
- , unfoldingUseThreshold = 80
+ , unfoldingUseThreshold = 70
-- Adjusted 90 -> 80 when adding discounts for free variables which
-- generally make things more likely to inline. Reducing the threshold
-- eliminates some undesirable compile-time regressions (e.g. T10412a)
@@ -214,7 +214,7 @@ defaultUnfoldingOpts = UnfoldingOpts
-- Previously: adjusted upwards in #18282, when I reduced
-- the result discount for constructors.
- , unfoldingFunAppDiscount = 60
+ , unfoldingFunAppDiscount = 30
-- Be fairly keen to inline a function if that means
-- we'll be able to pick the right method from a dictionary
@@ -882,12 +882,11 @@ conSize :: DataCon -> Int -> ExprTree
conSize dc n_val_args
| isUnboxedTupleDataCon dc
= etZero -- See Note [Unboxed tuple size and result discount]
+ | n_val_args == 0 -- Like variables
+ = etZero
| otherwise -- See Note [Constructor size and result discount]
- = ExprTree { et_size = size, et_wc_tot = size
+ = ExprTree { et_size = 10, et_wc_tot = 10
, et_cases = emptyBag, et_ret = 10 }
- where
- size | n_val_args == 0 = 0 -- Like variables
- | otherwise = 10
primOpSize :: PrimOp -> Int -> Size
primOpSize op n_val_args
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/ddd17134826249bbe87c370dbcabb12fc7a6c5d9
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/ddd17134826249bbe87c370dbcabb12fc7a6c5d9
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/20231119/f596476a/attachment-0001.html>
More information about the ghc-commits
mailing list