summaryrefslogtreecommitdiff
path: root/compiler/GHC/Core/Opt
diff options
context:
space:
mode:
authorSebastian Graf <sebastian.graf@kit.edu>2022-11-22 19:07:27 +0100
committerSebastian Graf <sebastian.graf@kit.edu>2022-11-29 09:13:41 +0100
commitfecf0aa1e5491ac30e491ad163bd2fc2c7510e76 (patch)
treea49800a7b1df51878dec1824043391b817cc8297 /compiler/GHC/Core/Opt
parentdef47dd32491311289bff26230b664c895f178cc (diff)
downloadhaskell-wip/T22475.tar.gz
DmdAnal: Reflect the `seq` of strict fields of a DataCon worker (#22475)wip/T22475
See the updated `Note [Data-con worker strictness]` and the new `Note [Demand transformer for data constructors]`. Fixes #22475.
Diffstat (limited to 'compiler/GHC/Core/Opt')
-rw-r--r--compiler/GHC/Core/Opt/Arity.hs2
-rw-r--r--compiler/GHC/Core/Opt/DmdAnal.hs6
2 files changed, 4 insertions, 4 deletions
diff --git a/compiler/GHC/Core/Opt/Arity.hs b/compiler/GHC/Core/Opt/Arity.hs
index b12478cbab..fbbcf1c2ad 100644
--- a/compiler/GHC/Core/Opt/Arity.hs
+++ b/compiler/GHC/Core/Opt/Arity.hs
@@ -2677,7 +2677,7 @@ tryEtaReduce rec_ids bndrs body eval_sd
-- ... and that the function can be eta reduced to arity 0
-- without violating invariants of Core and GHC
&& canEtaReduceToArity fun 0 0 -- criteria (L), (J), (W), (B)
- all_calls_with_arity n = isStrict (peelManyCalls n eval_sd)
+ all_calls_with_arity n = isStrict (fst $ peelManyCalls n eval_sd)
-- See Note [Eta reduction based on evaluation context]
---------------
diff --git a/compiler/GHC/Core/Opt/DmdAnal.hs b/compiler/GHC/Core/Opt/DmdAnal.hs
index a14964c12e..74316e1e1b 100644
--- a/compiler/GHC/Core/Opt/DmdAnal.hs
+++ b/compiler/GHC/Core/Opt/DmdAnal.hs
@@ -982,9 +982,9 @@ dmdTransform :: AnalEnv -- ^ The analysis environment
-- See Note [What are demand signatures?] in "GHC.Types.Demand"
dmdTransform env var sd
-- Data constructors
- | isDataConWorkId var
- = -- pprTraceWith "dmdTransform:DataCon" (\ty -> ppr var $$ ppr sd $$ ppr ty) $
- dmdTransformDataConSig (idArity var) sd
+ | Just con <- isDataConWorkId_maybe var
+ = -- pprTraceWith "dmdTransform:DataCon" (\ty -> ppr con $$ ppr sd $$ ppr ty) $
+ dmdTransformDataConSig (dataConRepStrictness con) sd
-- See Note [DmdAnal for DataCon wrappers]
| isDataConWrapId var, let rhs = uf_tmpl (realIdUnfolding var)
, WithDmdType dmd_ty _rhs' <- dmdAnal env sd rhs