[Git][ghc/ghc][wip/spj-unf-size] Adjust default thresholds slightly

Simon Peyton Jones (@simonpj) gitlab at gitlab.haskell.org
Wed Nov 22 13:54:42 UTC 2023



Simon Peyton Jones pushed to branch wip/spj-unf-size at Glasgow Haskell Compiler / GHC


Commits:
d8b35e38 by Simon Peyton Jones at 2023-11-22T13:54:14+00:00
Adjust default thresholds slightly

- - - - -


2 changed files:

- compiler/GHC/Core/Opt/Simplify/Inline.hs
- compiler/GHC/Core/Unfold.hs


Changes:

=====================================
compiler/GHC/Core/Opt/Simplify/Inline.hs
=====================================
@@ -263,11 +263,11 @@ tryUnfolding logger env fn cont unf_template unf_cache guidance
                               = case cont_info of
                                   BoringCtxt  -> 0
                                   DiscArgCtxt -> 0
-                                  RuleArgCtxt -> 0
+                                  RuleArgCtxt -> ret_discount
                                   CaseCtxt    -> ret_discount
                                   ValAppCtxt  -> ret_discount
                                   RhsCtxt {}  -> 40 `min` ret_discount
-                -- For RhsCtxt I suppose that exposing a data con is good in general
+                -- For RhsCtxt I suppose that exposing a data con is good in general;
                 -- although 40 seems very arbitrary
                 --
                 -- `min` thresholding: res_discount can be very large when a


=====================================
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   = 75
+   , unfoldingUseThreshold   = 80
       -- 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 = 45
+   , unfoldingFunAppDiscount = 30
       -- Be fairly keen to inline a function if that means
       -- we'll be able to pick the right method from a dictionary
 



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/d8b35e381b843c217ae2c07fe6a134eb9fbbcf48

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/d8b35e381b843c217ae2c07fe6a134eb9fbbcf48
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/20231122/6d0cf0a7/attachment-0001.html>


More information about the ghc-commits mailing list