summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Klebinger <klebinger.andreas@gmx.at>2023-02-03 14:10:30 +0100
committerAndreas Klebinger <klebinger.andreas@gmx.at>2023-02-03 14:10:30 +0100
commitd6cb3ffefa2cdc0c183fdc9449f6efd5fcce9757 (patch)
tree2b1084449c0f1770de6d0cf663cdaa782c0b6857
parent8feb93013cf6f093e025c9e9a3213ae1fa0f73a0 (diff)
downloadhaskell-wip/andreask/ww-noinline-dicts.tar.gz
W/W dicts if they are arguments to an NOINLINE function.wip/andreask/ww-noinline-dicts
We usually avoid doing so to ensure functions specialize. But since we don't specialize these functions there is reason not to do full W/W on them. Fixes #22758
-rw-r--r--compiler/GHC/Core/Opt/DmdAnal.hs7
1 files changed, 6 insertions, 1 deletions
diff --git a/compiler/GHC/Core/Opt/DmdAnal.hs b/compiler/GHC/Core/Opt/DmdAnal.hs
index 0bcabf55d3..282a85d90d 100644
--- a/compiler/GHC/Core/Opt/DmdAnal.hs
+++ b/compiler/GHC/Core/Opt/DmdAnal.hs
@@ -1772,6 +1772,10 @@ We never unbox class dictionaries in worker/wrapper.
to inline; the inlining heuristics seem to prefer to inline a function
applied to a dictionary over a function applied to a bunch of functions.
+4. We still W/W NOINLINE functions. The specialiser currently won't specialise
+ these anyway so there is no reason not to.
+ See Note [Auto-specialisation and RULES]
+
TL;DR we /never/ unbox class dictionaries. Unboxing the dictionary, and passing
a raft of higher-order functions isn't a huge win anyway -- you really want to
specialise the function.
@@ -1964,7 +1968,8 @@ finaliseArgBoxities env fn threshold_arity rhs_dmds div rhs
get_dmd :: Id -> Type -> Demand
get_dmd bndr bndr_ty
- | isClassPred bndr_ty = trimBoxity dmd
+ | isClassPred bndr_ty
+ , not (isNeverActive (idInlineActivation fn)) = trimBoxity dmd
-- See Note [Do not unbox class dictionaries]
-- NB: 'ty' has not been normalised, so this will (rightly)
-- catch newtype dictionaries too.