Improve demand analysis for join points
Consider
g :: (Int,Int) -> Int
g (p,q) = p+q
f :: Int -> Int -> Int
f x p = g (join j y = (p,y)
in case x of
True -> j 3
False -> j 4)
If j was a vanilla function definition, we'd analyse its body with
evalDmd, and think that it was lazy in p.
But for a join point we can do better. We know that
j's body (if evaluated at all) will be evaluated with the demand that consumes the entire
join-binding, in this case the argument demand from g. Whizzo! g
evaluates both components of its arugment pair, so j is strict in p.
So, when analysing a join point, we can analyse its body with the demand from the entire join-binding. Another win for join points!
Trac metadata
| Trac field | Value |
|---|---|
| Version | 8.0.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture |