[Git][ghc/ghc][wip/T17910] 2 commits: Wibbles (comments etc)
Simon Peyton Jones (@simonpj)
gitlab at gitlab.haskell.org
Mon Oct 9 10:57:00 UTC 2023
Simon Peyton Jones pushed to branch wip/T17910 at Glasgow Haskell Compiler / GHC
Commits:
db318730 by Simon Peyton Jones at 2023-10-09T10:54:40+01:00
Wibbles (comments etc)
and remove shrinking of LargeRecord
- - - - -
3ffe97ea by Simon Peyton Jones at 2023-10-09T11:56:33+01:00
Inline naturally occurring top level 'build's
- - - - -
3 changed files:
- compiler/GHC/Core/Opt/Arity.hs
- compiler/GHC/Core/Opt/Simplify/Utils.hs
- testsuite/tests/perf/compiler/LargeRecord.hs
Changes:
=====================================
compiler/GHC/Core/Opt/Arity.hs
=====================================
@@ -231,7 +231,7 @@ typeOneShot ty
-- See Note [The state-transformer hack] in "GHC.Core.Opt.Arity"
idStateHackOneShotInfo :: Id -> OneShotInfo
idStateHackOneShotInfo id
- = case idOneShotInfo id of
+ = case idOneShotInfo id of -- Test idOneShotInfo first because it is fast
OneShotLam -> OneShotLam
NoOneShotInfo | isStateHackType (idType id) -> OneShotLam
| otherwise -> NoOneShotInfo
=====================================
compiler/GHC/Core/Opt/Simplify/Utils.hs
=====================================
@@ -1423,8 +1423,14 @@ preInlineUnconditionally env top_lvl bndr rhs rhs_env
one_occ OneOcc{ occ_n_br = 1, occ_in_lam = in_lam, occ_int_cxt = int_cxt }
| is_value_lam rhs, IsInteresting <- int_cxt
= True
- | NotInsideLam <- in_lam -- Once things are flattened to top level, don't
- , not (isTopLevel top_lvl) -- re-inline them. See Note [Floating to the top]
+ | NotInsideLam <- in_lam
+ , not (isTopLevel top_lvl) || not (exprIsExpandable rhs)
+ -- Inline used-once things; except expandable things at top level
+ -- These may arise from user code e.g.
+ -- x = [1,2,3]
+ -- y = length x -- Want this to fuse
+ -- Real world example: the [1..] in 'preparse' in nofibl/real/cacheprof
+ -- See Note [Floating to the top]
= True
| otherwise
= False
@@ -1436,7 +1442,6 @@ preInlineUnconditionally env top_lvl bndr rhs rhs_env
{-
one_occ OneOcc{ occ_n_br = 1
-
, occ_in_lam = NotInsideLam } = isNotTopLevel top_lvl || early_phase
one_occ OneOcc{ occ_n_br = 1
, occ_in_lam = IsInsideLam
=====================================
testsuite/tests/perf/compiler/LargeRecord.hs
=====================================
@@ -60,7 +60,6 @@ type BigFieldList =
'[ "f1" := Int
, "f2" := Int
, "f3" := Int
-{-
, "f4" := Int
, "f5" := Int
, "f6" := Int
@@ -73,7 +72,6 @@ type BigFieldList =
, "f13" := Int
, "f14" := Int
, "f15" := Int
--}
]
bigRec :: Record BigFieldList
@@ -81,7 +79,6 @@ bigRec =
#f1 := 1
& #f2 := 2
& #f3 := 3
-{-
& #f4 := 4
& #f5 := 5
& #f6 := 6
@@ -94,7 +91,6 @@ bigRec =
& #f13 := 13
& #f14 := 14
& #f15 := 15
--}
& rnil
main :: IO ()
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/b4ce235a1871c89e61ad2d218f5673bff6e0a902...3ffe97ea452cd9aa8c4a4233c4c7b1994aaa81ce
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/b4ce235a1871c89e61ad2d218f5673bff6e0a902...3ffe97ea452cd9aa8c4a4233c4c7b1994aaa81ce
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/20231009/8ccca33c/attachment-0001.html>
More information about the ghc-commits
mailing list