summaryrefslogtreecommitdiff
path: root/compiler/stranal/DmdAnal.hs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/stranal/DmdAnal.hs')
-rw-r--r--compiler/stranal/DmdAnal.hs11
1 files changed, 8 insertions, 3 deletions
diff --git a/compiler/stranal/DmdAnal.hs b/compiler/stranal/DmdAnal.hs
index 27fa35fba0..d6155622dd 100644
--- a/compiler/stranal/DmdAnal.hs
+++ b/compiler/stranal/DmdAnal.hs
@@ -619,9 +619,14 @@ dmdAnalRhs top_lvl rec_flag env id rhs
-- See Note [NOINLINE and strictness]
-- See Note [Product demands for function body]
- body_dmd = case deepSplitProductType_maybe (ae_fam_envs env) (exprType body) of
- Nothing -> cleanEvalDmd
- Just (dc, _, _, _) -> cleanEvalProdDmd (dataConRepArity dc)
+ body_dmd
+ | Just (dc, _, _, _) <- deepSplitProductType_maybe (ae_fam_envs env) (exprType body)
+ = cleanEvalProdDmd (dataConRepArity dc)
+ | isStateHackFunType $ topNormaliseType (ae_fam_envs env) (exprType body)
+ = -- pprTrace "new state hack" (ppr (exprType body)) $
+ cleanEvalStateHackDmd
+ | otherwise
+ = cleanEvalDmd
-- See Note [Lazy and unleashable free variables]
-- See Note [Aggregated demand for cardinality]