Skip to content

Commit 0500a66

Browse files
committed
Disable speculative evaluation in coreprep in ghc 9.4, 9.6, 9.8
Speculative evaluation was found to cause a large increase in allocations in certain situations. We disable it for now.
1 parent 83050d6 commit 0500a66

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

overlays/bootstrap.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ in {
8484
# will be applied to most versions of the GHC anyway (reordering the patches
8585
# results in rebuilds of GHC and reduces sharing in /nix/store).
8686
in always ./patches/ghc/dll-loader-8.4.2.patch # https://gitlab.haskell.org/ghc/ghc/merge_requests/949 -- open
87+
++ fromUntil "9.4" "9.10" ./patches/ghc/ghc-9.4-9.6-9.8-disable-coreprep-spec-eval.patch # causes more allocations
8788
++ until "9.2" ./patches/ghc/ghc-8.4.3-Cabal2201-no-hackage-tests.patch # ?
8889
++ until "9.2" ./patches/ghc/cabal-host.patch # https://github.com/haskell/cabal/issues/5887
8990
++ fromUntil "9.2" "9.4" ./patches/ghc/ghc-9.2-cabal-host.patch # https://github.com/haskell/cabal/issues/5887
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
diff --git a/compiler/GHC/CoreToStg/Prep.hs b/compiler/GHC/CoreToStg/Prep.hs
2+
index c463f41121..58b1d957c8 100644
3+
--- a/compiler/GHC/CoreToStg/Prep.hs
4+
+++ b/compiler/GHC/CoreToStg/Prep.hs
5+
@@ -1759,7 +1759,7 @@ data OkToSpec
6+
7+
mkFloat :: CorePrepEnv -> Demand -> Bool -> Id -> CpeRhs -> FloatingBind
8+
mkFloat env dmd is_unlifted bndr rhs
9+
- | is_strict || ok_for_spec -- See Note [Speculative evaluation]
10+
+ | is_strict {-|| ok_for_spec-} -- See Note [Speculative evaluation]
11+
, not is_hnf = FloatCase rhs bndr DEFAULT [] ok_for_spec
12+
-- Don't make a case for a HNF binding, even if it's strict
13+
-- Otherwise we get case (\x -> e) of ...!

0 commit comments

Comments
 (0)