summaryrefslogtreecommitdiff
path: root/compiler/GHC/Core/Opt/Specialise.hs
diff options
context:
space:
mode:
authorSebastian Graf <sebastian.graf@kit.edu>2022-02-28 14:52:36 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-03-13 18:12:48 -0400
commit76b94b726f6e21bb2a46ae04e4a1be2cba45a3dc (patch)
tree8db126a5c8718140a6cd7bdd8f3a20df257f580c /compiler/GHC/Core/Opt/Specialise.hs
parentad83553153278947f439951d79a842527f2f0983 (diff)
downloadhaskell-76b94b726f6e21bb2a46ae04e4a1be2cba45a3dc.tar.gz
Worker/wrapper: Preserve float barriers (#21150)
Issue #21150 shows that worker/wrapper allocated a worker function for a function with multiple calls that said "called at most once" when the first argument was absent. That's bad! This patch makes it so that WW preserves at least one non-one-shot value lambda (see `Note [Preserving float barriers]`) by passing around `void#` in place of absent arguments. Fixes #21150. Since the fix is pretty similar to `Note [Protecting the last value argument]`, I put the logic in `mkWorkerArgs`. There I realised (#21204) that `-ffun-to-thunk` is basically useless with `-ffull-laziness`, so I deprecated the flag, simplified and split into `needsVoidWorkerArg`/`addVoidWorkerArg`. SpecConstr is another client of that API. Fixes #21204. Metric Decrease: T14683
Diffstat (limited to 'compiler/GHC/Core/Opt/Specialise.hs')
-rw-r--r--compiler/GHC/Core/Opt/Specialise.hs2
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/GHC/Core/Opt/Specialise.hs b/compiler/GHC/Core/Opt/Specialise.hs
index cbf3a4e10e..d80e78f685 100644
--- a/compiler/GHC/Core/Opt/Specialise.hs
+++ b/compiler/GHC/Core/Opt/Specialise.hs
@@ -1519,7 +1519,7 @@ specCalls spec_imp env existing_rules calls_for_me fn rhs
-- Maybe add a void arg to the specialised function,
-- to avoid unlifted bindings
-- See Note [Specialisations Must Be Lifted]
- -- C.f. GHC.Core.Opt.WorkWrap.Utils.mkWorkerArgs
+ -- C.f. GHC.Core.Opt.WorkWrap.Utils.needsVoidWorkerArg
add_void_arg = isUnliftedType spec_fn_ty1 && not (isJoinId fn)
(spec_bndrs, spec_rhs, spec_fn_ty)
| add_void_arg = ( voidPrimId : spec_bndrs1