Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable speculative evaluation in coreprep in ghc 9.4, 9.6, 9.8 #2253

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions overlays/bootstrap.nix
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ in {
# will be applied to most versions of the GHC anyway (reordering the patches
# results in rebuilds of GHC and reduces sharing in /nix/store).
in until "9.11" ./patches/ghc/dll-loader-8.4.2.patch # https://gitlab.haskell.org/ghc/ghc/merge_requests/949 -- open
++ fromUntil "9.4" "9.12" ./patches/ghc/ghc-9.4-9.6-9.8-disable-coreprep-spec-eval.patch # causes more allocations
++ until "9.2" ./patches/ghc/ghc-8.4.3-Cabal2201-no-hackage-tests.patch # ?
++ until "9.2" ./patches/ghc/cabal-host.patch # https://github.com/haskell/cabal/issues/5887
++ fromUntil "9.2" "9.4" ./patches/ghc/ghc-9.2-cabal-host.patch # https://github.com/haskell/cabal/issues/5887
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
diff --git a/compiler/GHC/CoreToStg/Prep.hs b/compiler/GHC/CoreToStg/Prep.hs
index c463f41121..3673b94991 100644
--- a/compiler/GHC/CoreToStg/Prep.hs
+++ b/compiler/GHC/CoreToStg/Prep.hs
@@ -1785,7 +1785,14 @@ mkFloat env dmd is_unlifted bndr rhs
where
is_hnf = exprIsHNF rhs
is_strict = isStrUsedDmd dmd
- ok_for_spec = exprOkForSpecEval (not . is_rec_call) rhs
+ ok_for_spec = exprOkForSpecEval fun_ok_for_spec rhs
+ fun_ok_for_spec i
+ | is_rec_call i = False
+ | otherwise =
+ case idDetails i of
+ DFunId {} -> False
+ DataConWorkId {} -> False
+ _ -> True
is_rec_call = (`elemUnVarSet` cpe_rec_ids env)

emptyFloats :: Floats
Loading