Fix arityType: -fpedantic-bottoms, join points, etc
This MR fixes #21694 and #21755 * For #21694 the underlying problem was that we were calling arityType on an expression that had free join points. This is a Bad Bad Idea. See Note [No free join points in arityType]. * I also made andArityType work correctly with -fpedantic-bottoms; see Note [Combining case branches: andWithTail]. * I realised that, now we have ae_sigs giving the ArityType for let-bound Ids, we don't need the (pre-dating) special code in arityType for join points. But instead we need to extend the env for Rec bindings, which weren't doing before. More uniform now. See Note [arityType for let-bindings]. This meant we could get rid of ae_joins, and in fact get rid of EtaExpandArity altogether. Simpler. And finally, it was the strange treatment of join-point Ids (involving a fake ABot type) that led to a serious bug: #21755. Fixed by this refactoring * Rewrote Note [Combining case branches: optimistic one-shot-ness] Compile time improves slightly on average: Metrics: compile_time/bytes allocated --------------------------------------------------------------------------------------- CoOpt_Read(normal) ghc/alloc 803,788,056 747,832,680 -7.1% GOOD T18223(normal) ghc/alloc 928,207,320 959,424,016 +3.1% BAD geo. mean -0.3% minimum -7.1% maximum +3.1% On Windows it's a bit better: geo mean is -0.6%, and three more benchmarks trip their compile-time bytes-allocated threshold (they were all close on the other build): T18698b(normal) ghc/alloc 235,619,776 233,219,008 -1.0% GOOD T6048(optasm) ghc/alloc 112,208,192 109,704,936 -2.2% GOOD T18140(normal) ghc/alloc 85,064,192 83,168,360 -2.2% GOOD I had a quick look at T18223 but it is knee deep in coercions and the size of everything looks similar before and after. I decided to accept that 3.4% increase in exchange for goodness elsewhere. Metric Decrease: CoOpt_Read T18140 T18698b T6048 Metric Increase: T18223 (cherry picked from commit 5e282da37e19a1ab24ae167daf32276a64ed2842)
parent
9a12e496
No related branches found
No related tags found
Pipeline #58291 failed
Stage: tool-lint
Stage: quick-build
Stage: full-build
Stage: packaging
Stage: testing
Showing
- compiler/GHC/Core.hs 1 addition, 0 deletionscompiler/GHC/Core.hs
- compiler/GHC/Core/Opt/Arity.hs 247 additions, 96 deletionscompiler/GHC/Core/Opt/Arity.hs
- compiler/GHC/Core/Opt/Simplify.hs 37 additions, 11 deletionscompiler/GHC/Core/Opt/Simplify.hs
- compiler/GHC/Core/Opt/Simplify/Utils.hs 1 addition, 3 deletionscompiler/GHC/Core/Opt/Simplify/Utils.hs
- testsuite/tests/arityanal/should_compile/T21755.hs 11 additions, 0 deletionstestsuite/tests/arityanal/should_compile/T21755.hs
- testsuite/tests/arityanal/should_compile/T21755.stderr 1 addition, 0 deletionstestsuite/tests/arityanal/should_compile/T21755.stderr
- testsuite/tests/arityanal/should_compile/all.T 1 addition, 0 deletionstestsuite/tests/arityanal/should_compile/all.T
- testsuite/tests/callarity/should_compile/T21694a.hs 27 additions, 0 deletionstestsuite/tests/callarity/should_compile/T21694a.hs
- testsuite/tests/callarity/should_compile/T21694a.stderr 3 additions, 0 deletionstestsuite/tests/callarity/should_compile/T21694a.stderr
- testsuite/tests/simplCore/should_compile/T21694b.hs 6 additions, 0 deletionstestsuite/tests/simplCore/should_compile/T21694b.hs
- testsuite/tests/simplCore/should_compile/T21694b.stderr 115 additions, 0 deletionstestsuite/tests/simplCore/should_compile/T21694b.stderr
Loading
Please register or sign in to comment