[Git][ghc/ghc][wip/marge_bot_batch_merge_job] 5 commits: Inline join points for rhs without free vars

Marge Bot (@marge-bot) gitlab at gitlab.haskell.org
Sun Feb 16 04:59:55 UTC 2025



Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC


Commits:
1b6cc6f1 by Rodrigo Mesquita at 2025-02-15T23:59:31-05:00
Inline join points for rhs without free vars

While investigating #25170, we ran into a program (T16473) that allocated 67%
more because of a join point that failed to inline.

Note [Duplicating join points] explains why we want to be conservative
when inlining join points, using as an example a join point that
captures a free variable `f` that becomes available in the continuation
`blah` for further optimisations, as opposed to being lambda-abstracted.

However, when the RHS of the join point has no free variables and is
trivial, the same argument does not apply, and there's nothing to gain
from preserving it.

On the contrary, not inlining these trivial join points such as
    $j f x = K f x |> co
can be actively harmful as they prevent useful optimisations from firing
on the known constructor application. #25723 is such an example.

Therefore, we've extended `uncondInlineJoin` to allow duplicating such closed
trivial join points. See the updated Note [Duplicating join points] for
further details.

Additionally, merge the guards in uncondInlineJoin for point DJ3(b) anad DJ3(c) of
Note [Duplicating join points] to avoid an unnecessary traversal in the
call to `collectArgs`; it's also more uniform.

Co-authored-by: Simon Peyton Jones <simon.peytonjones at gmail.com>

Fixes #25723

- - - - -
b7be5056 by M Farkas-Dyck at 2025-02-15T23:59:42-05:00
Scrub some partiality in `GHC.Tc.Gen.Match`.

In particular, we construct a list of the same length as another list, then loop over both and panic if their lengths are unequal. We can avoid this.

- - - - -
6ead2130 by M Farkas-Dyck at 2025-02-15T23:59:42-05:00
Make list of `ParStmtBlock` in `ParStmt` `NonEmpty`.

In the ParStmt constructor Language.Haskell.Syntax.Expr.StmtLR, the 2nd argument, the list of ParStmtBlocks, must be NonEmpty; make it so.

- - - - -
b62c892c by M Farkas-Dyck at 2025-02-15T23:59:42-05:00
GHC.Tc.Gen.Match: Added type signatures for `loop` functions.

- - - - -
19c47d98 by Sylvain Henry at 2025-02-15T23:59:45-05:00
Remove a bunch of Makefiles from old build system

- - - - -


32 changed files:

- compiler/GHC/Core/Opt/Simplify/Iteration.hs
- compiler/GHC/Core/Unfold.hs
- compiler/GHC/Hs/Expr.hs
- compiler/GHC/Hs/Utils.hs
- compiler/GHC/HsToCore/ListComp.hs
- compiler/GHC/HsToCore/Quote.hs
- compiler/GHC/Parser.y
- compiler/GHC/Rename/Expr.hs
- compiler/GHC/Tc/Errors/Ppr.hs
- compiler/GHC/Tc/Errors/Types.hs
- compiler/GHC/Tc/Gen/Match.hs
- compiler/GHC/Tc/Zonk/Type.hs
- compiler/GHC/ThToHs.hs
- compiler/GHC/Types/Error/Codes.hs
- compiler/Language/Haskell/Syntax/Expr.hs
- docs/users_guide/9.14.1-notes.rst
- + testsuite/tests/perf/compiler/T25723.hs
- + testsuite/tests/perf/compiler/T25723.stdout
- testsuite/tests/perf/compiler/all.T
- testsuite/tests/simplCore/should_compile/T24229a.stderr
- testsuite/tests/simplCore/should_compile/T24229b.stderr
- + testsuite/tests/th/EmptyParStmt.hs
- + testsuite/tests/th/EmptyParStmt.stderr
- testsuite/tests/th/all.T
- − utils/deriveConstants/Makefile
- − utils/genprimopcode/Makefile
- − utils/ghc-pkg/Makefile
- − utils/hp2ps/Makefile
- − utils/iserv/Makefile
- − utils/remote-iserv/Makefile
- − utils/runghc/Makefile
- − utils/unlit/Makefile


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/797059f70f8c55d8da4a8b931f195364c194d5e2...19c47d986df97f25ff9ebb31ca58879ce04ff368

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/797059f70f8c55d8da4a8b931f195364c194d5e2...19c47d986df97f25ff9ebb31ca58879ce04ff368
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/20250215/19cd610a/attachment.html>


More information about the ghc-commits mailing list