CorePrep: Eta expand arguments (#23083)
Previously, we'd only eta expand let bindings and lambdas, now we'll also eta expand arguments such as in T23083: ```hs g f h = f (h `seq` (h $)) ``` Unless `-fpedantic-bottoms` is set, we'll now transform to ```hs g f h = f (\eta -> h eta) ``` in CorePrep. See the new `Note [Eta expansion of arguments in CorePrep]` for the details. We only do this optimisation with -O2 because we saw 2-3% ghc/alloc regressions in T4801 and T5321FD. Fixes #23083.
Showing
- compiler/GHC/Core/Opt/Arity.hs 2 additions, 3 deletionscompiler/GHC/Core/Opt/Arity.hs
- compiler/GHC/CoreToStg/Prep.hs 103 additions, 1 deletioncompiler/GHC/CoreToStg/Prep.hs
- compiler/GHC/Driver/Config/CoreToStg/Prep.hs 7 additions, 2 deletionscompiler/GHC/Driver/Config/CoreToStg/Prep.hs
- compiler/GHC/Driver/DynFlags.hs 2 additions, 1 deletioncompiler/GHC/Driver/DynFlags.hs
- compiler/GHC/Driver/Flags.hs 1 addition, 0 deletionscompiler/GHC/Driver/Flags.hs
- compiler/GHC/Driver/Session.hs 1 addition, 2 deletionscompiler/GHC/Driver/Session.hs
- docs/users_guide/using-optimisation.rst 11 additions, 0 deletionsdocs/users_guide/using-optimisation.rst
- testsuite/tests/simplCore/should_compile/T23083.hs 10 additions, 0 deletionstestsuite/tests/simplCore/should_compile/T23083.hs
- testsuite/tests/simplCore/should_compile/T23083.stderr 47 additions, 0 deletionstestsuite/tests/simplCore/should_compile/T23083.stderr
- testsuite/tests/simplCore/should_compile/all.T 1 addition, 0 deletionstestsuite/tests/simplCore/should_compile/all.T
Loading
Please register or sign in to comment