diff options
author | Simon Peyton Jones <simon.peytonjones@gmail.com> | 2023-01-17 12:00:15 +0000 |
---|---|---|
committer | Simon Peyton Jones <simon.peytonjones@gmail.com> | 2023-02-09 16:04:47 +0000 |
commit | 5b47b0821fcea6d11aa73fe2faca145177b1b710 (patch) | |
tree | 809d91625455995e910129f09e37762a72765994 /compiler/GHC/Core/Utils.hs | |
parent | 2ea1a6bc7d7c2946b4a3d1c2c19083e09401f9f1 (diff) | |
download | haskell-wip/T22761.tar.gz |
Refactor the simplifier a bit to fix #22761wip/T22761
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.
Diffstat (limited to 'compiler/GHC/Core/Utils.hs')
-rw-r--r-- | compiler/GHC/Core/Utils.hs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/GHC/Core/Utils.hs b/compiler/GHC/Core/Utils.hs index ff3357e87b..d36f0a14f2 100644 --- a/compiler/GHC/Core/Utils.hs +++ b/compiler/GHC/Core/Utils.hs @@ -513,8 +513,8 @@ bindNonRec bndr rhs body -- | Tests whether we have to use a @case@ rather than @let@ binding for this -- expression as per the invariants of 'CoreExpr': see "GHC.Core#let_can_float_invariant" needsCaseBinding :: Type -> CoreExpr -> Bool -needsCaseBinding ty rhs = - mightBeUnliftedType ty && not (exprOkForSpeculation rhs) +needsCaseBinding ty rhs + = mightBeUnliftedType ty && not (exprOkForSpeculation rhs) -- Make a case expression instead of a let -- These can arise either from the desugarer, -- or from beta reductions: (\x.e) (x +# y) |