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.hs19
1 files changed, 17 insertions, 2 deletions
diff --git a/compiler/stranal/DmdAnal.hs b/compiler/stranal/DmdAnal.hs
index 9a4c64bdbb..afde951e60 100644
--- a/compiler/stranal/DmdAnal.hs
+++ b/compiler/stranal/DmdAnal.hs
@@ -603,8 +603,8 @@ dmdAnalRhsLetDown top_lvl rec_flag env let_dmd id rhs
rhs_arity = idArity id
rhs_dmd
-- See Note [Demand analysis for join points]
- -- See Note [idArity for join points] in SimplUtils
- -- rhs_arity matches the join arity of the join point
+ -- See Note [Invariants on join points] invariant 2b, in CoreSyn
+ -- rhs_arity matches the join arity of the join point
| isJoinId id
= mkCallDmds rhs_arity let_dmd
| otherwise
@@ -727,6 +727,21 @@ let_dmd here).
Another win for join points! #13543.
+However, note that the strictness signature for a join point can
+look a little puzzling. E.g.
+
+ (join j x = \y. error "urk")
+ (in case v of )
+ ( A -> j 3 ) x
+ ( B -> j 4 )
+ ( C -> \y. blah )
+
+The entire thing is in a C(S) context, so j's strictness signature
+will be [A]b
+meaning one absent argument, returns bottom. That seems odd because
+there's a \y inside. But it's right because when consumed in a C(1)
+context the RHS of the join point is indeed bottom.
+
Note [Demand signatures are computed for a threshold demand based on idArity]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
We compute demand signatures assuming idArity incoming arguments to approximate