Eta reduction based on evaluation context (#21261)
I completely rewrote our Notes surrounding eta-reduction. The new entry point is `Note [Eta reduction makes sense]`. Then I went on to extend the Simplifier to maintain an evaluation context in the form of a `SubDemand` inside a `SimplCont`. That `SubDemand` is useful for doing eta reduction according to `Note [Eta reduction based on evaluation context]`, which describes how Demand analysis, Simplifier and `tryEtaReduce` interact to facilitate eta reduction in more scenarios. Thus we fix #21261. ghc/alloc perf marginally improves (-0.0%). A medium-sized win is when compiling T3064 (-3%). It seems that haddock improves by 0.6% to 1.0%, too. Metric Decrease: T3064
Showing
- compiler/GHC/Core/Opt/Simplify.hs 3 additions, 5 deletionscompiler/GHC/Core/Opt/Simplify.hs
- compiler/GHC/Core/Opt/Simplify/Env.hs 4 additions, 4 deletionscompiler/GHC/Core/Opt/Simplify/Env.hs
- compiler/GHC/Core/Opt/Simplify/Utils.hs 68 additions, 21 deletionscompiler/GHC/Core/Opt/Simplify/Utils.hs
- compiler/GHC/Core/SimpleOpt.hs 3 additions, 3 deletionscompiler/GHC/Core/SimpleOpt.hs
- compiler/GHC/Core/Utils.hs 212 additions, 101 deletionscompiler/GHC/Core/Utils.hs
- compiler/GHC/Types/Demand.hs 7 additions, 1 deletioncompiler/GHC/Types/Demand.hs
- testsuite/tests/simplCore/should_compile/T20040.hs 22 additions, 0 deletionstestsuite/tests/simplCore/should_compile/T20040.hs
- testsuite/tests/simplCore/should_compile/T20040.stderr 32 additions, 0 deletionstestsuite/tests/simplCore/should_compile/T20040.stderr
- testsuite/tests/simplCore/should_compile/T21261.hs 47 additions, 0 deletionstestsuite/tests/simplCore/should_compile/T21261.hs
- testsuite/tests/simplCore/should_compile/T21261.stderr 73 additions, 0 deletionstestsuite/tests/simplCore/should_compile/T21261.stderr
- testsuite/tests/simplCore/should_compile/all.T 7 additions, 0 deletionstestsuite/tests/simplCore/should_compile/all.T
Loading
Please register or sign in to comment