WorkWrap: Remove mkWWargs (#19874)
`mkWWargs`'s job was pushing casts inwards and doing eta expansion to match the arity with the number of argument demands we w/w for. Nowadays, we use the Simplifier to eta expand to arity. In fact, in recent years we have even seen the eta expansion done by w/w as harmful, see Note [Don't eta expand in w/w]. If a function hasn't enough manifest lambdas, don't w/w it! What purpose does `mkWWargs` serve in this world? Not a great one, it turns out! I could remove it by pulling some important bits, notably Note [Freshen WW arguments] and Note [Join points and beta-redexes]. Result: We reuse the freshened binder names of the wrapper in the worker where possible (see testuite changes), much nicer! In order to avoid scoping errors due to lambda-bound unfoldings in worker arguments, we zap those unfoldings now. In doing so, we fix #19766. Fixes #19874.
Showing
- compiler/GHC/Core/Opt/WorkWrap.hs 16 additions, 9 deletionscompiler/GHC/Core/Opt/WorkWrap.hs
- compiler/GHC/Core/Opt/WorkWrap/Utils.hs 150 additions, 186 deletionscompiler/GHC/Core/Opt/WorkWrap/Utils.hs
- testsuite/tests/simplCore/should_compile/T13143.stderr 12 additions, 12 deletionstestsuite/tests/simplCore/should_compile/T13143.stderr
- testsuite/tests/simplCore/should_compile/T15631.stdout 4 additions, 4 deletionstestsuite/tests/simplCore/should_compile/T15631.stdout
- testsuite/tests/simplCore/should_compile/T18013.stderr 4 additions, 4 deletionstestsuite/tests/simplCore/should_compile/T18013.stderr
- testsuite/tests/simplCore/should_compile/T19246.stderr 1 addition, 1 deletiontestsuite/tests/simplCore/should_compile/T19246.stderr
- testsuite/tests/simplCore/should_compile/T3717.stderr 4 additions, 4 deletionstestsuite/tests/simplCore/should_compile/T3717.stderr
- testsuite/tests/simplCore/should_compile/T3772.stdout 3 additions, 3 deletionstestsuite/tests/simplCore/should_compile/T3772.stdout
- testsuite/tests/simplCore/should_compile/T4908.stderr 6 additions, 6 deletionstestsuite/tests/simplCore/should_compile/T4908.stderr
- testsuite/tests/simplCore/should_compile/T4930.stderr 4 additions, 4 deletionstestsuite/tests/simplCore/should_compile/T4930.stderr
- testsuite/tests/simplCore/should_compile/T5298.stdout 2 additions, 2 deletionstestsuite/tests/simplCore/should_compile/T5298.stdout
- testsuite/tests/simplCore/should_compile/T8331.stderr 1 addition, 1 deletiontestsuite/tests/simplCore/should_compile/T8331.stderr
- testsuite/tests/simplCore/should_compile/spec-inline.stderr 8 additions, 8 deletionstestsuite/tests/simplCore/should_compile/spec-inline.stderr
- testsuite/tests/stranal/should_compile/T16029.stdout 4 additions, 4 deletionstestsuite/tests/stranal/should_compile/T16029.stdout
- testsuite/tests/stranal/should_compile/T19766.hs 19 additions, 0 deletionstestsuite/tests/stranal/should_compile/T19766.hs
- testsuite/tests/stranal/should_compile/all.T 1 addition, 0 deletionstestsuite/tests/stranal/should_compile/all.T
Loading
Please register or sign in to comment