Refactor the simplifier a bit to fix #22761
The core change in this commit, which fixes #22761, is that * In a Core rule, ru_rhs is always occ-analysed. This means adding a couple of calls to occurAnalyseExpr when building a Rule, in * GHC.Core.Rules.mkRule * GHC.Core.Opt.Simplify.Iteration.simplRules But diagosing the bug made me stare carefully at the code of the Simplifier, and I ended up doing some only-loosely-related refactoring. * I think that RULES could be lost because not every code path did addBndrRules * The code around lambdas was very convoluted It's mainly moving deck chairs around, but I like it more now.
Showing
- compiler/GHC/Core.hs 44 additions, 18 deletionscompiler/GHC/Core.hs
- compiler/GHC/Core/Opt/Arity.hs 9 additions, 2 deletionscompiler/GHC/Core/Opt/Arity.hs
- compiler/GHC/Core/Opt/OccurAnal.hs 11 additions, 0 deletionscompiler/GHC/Core/Opt/OccurAnal.hs
- compiler/GHC/Core/Opt/Simplify/Env.hs 1 addition, 1 deletioncompiler/GHC/Core/Opt/Simplify/Env.hs
- compiler/GHC/Core/Opt/Simplify/Iteration.hs 177 additions, 146 deletionscompiler/GHC/Core/Opt/Simplify/Iteration.hs
- compiler/GHC/Core/Opt/Simplify/Utils.hs 4 additions, 1 deletioncompiler/GHC/Core/Opt/Simplify/Utils.hs
- compiler/GHC/Core/Rules.hs 13 additions, 7 deletionscompiler/GHC/Core/Rules.hs
- compiler/GHC/Core/Utils.hs 2 additions, 2 deletionscompiler/GHC/Core/Utils.hs
- compiler/GHC/Types/Id.hs 8 additions, 6 deletionscompiler/GHC/Types/Id.hs
- testsuite/tests/simplCore/should_compile/T22761.hs 40 additions, 0 deletionstestsuite/tests/simplCore/should_compile/T22761.hs
- testsuite/tests/simplCore/should_compile/T22761a.hs 4 additions, 0 deletionstestsuite/tests/simplCore/should_compile/T22761a.hs
- 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