diff options
author | Sebastian Graf <sebastian.graf@kit.edu> | 2023-03-07 13:23:19 +0100 |
---|---|---|
committer | Sebastian Graf <sebastian.graf@kit.edu> | 2023-05-17 17:17:25 +0200 |
commit | 5c8858846fb0d67a550f5943bf8bfced19b5f46b (patch) | |
tree | 5a1022059f8d7b96e55e1c3aa4b15e5308312acd /docs/users_guide/using-optimisation.rst | |
parent | faafe2a0ec4dcca1643c5bf3d52718eefc93d039 (diff) | |
download | haskell-wip/T23083.tar.gz |
CorePrep: Eta expand arguments (#23083)wip/T23083
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.
Diffstat (limited to 'docs/users_guide/using-optimisation.rst')
-rw-r--r-- | docs/users_guide/using-optimisation.rst | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/docs/users_guide/using-optimisation.rst b/docs/users_guide/using-optimisation.rst index c75d5e6097..d587c847d9 100644 --- a/docs/users_guide/using-optimisation.rst +++ b/docs/users_guide/using-optimisation.rst @@ -467,6 +467,17 @@ as such you shouldn't need to set any of them explicitly. A flag Eta-expand let-bindings to increase their arity. +.. ghc-flag:: -fdo-clever-arg-eta-expansion + :shortdesc: Enable sophisticated argument eta-expansion. Implied by :ghc-flag:`-O2`. + :type: dynamic + :reverse: -fno-do-clever-arg-eta-expansion + :category: + + :default: off + + Eta-expand arguments to increase their arity to avoid allocating unnecessary + thunks for them. + .. ghc-flag:: -feager-blackholing :shortdesc: Turn on :ref:`eager blackholing <parallel-compile-options>` :type: dynamic |