summaryrefslogtreecommitdiff
path: root/driver/utils/cwrapper.c
diff options
context:
space:
mode:
authorSebastian Graf <sebastian.graf@kit.edu>2020-10-30 17:20:37 +0100
committerSebastian Graf <sebastian.graf@kit.edu>2020-11-19 13:48:17 +0100
commit07723a60e07a8b9d9d9b646eaa0ffcf214e02ef8 (patch)
tree37a8c94b6666219bde2a474f889b950c523ed525 /driver/utils/cwrapper.c
parent29e792c06b112dbc523d24a1b95574fae7af5292 (diff)
downloadhaskell-07723a60e07a8b9d9d9b646eaa0ffcf214e02ef8.tar.gz
Demand: Interleave usage and strictness demands (#18903)
As outlined in #18903, interleaving usage and strictness demands not only means a more compact demand representation, but also allows us to express demands that we weren't easily able to express before. Call demands are *relative* in the sense that a call demand `Cn(cd)` on `g` says "`g` is called `n` times. *Whenever `g` is called*, the result is used according to `cd`". Example from #18903: ```hs h :: Int -> Int h m = let g :: Int -> (Int,Int) g 1 = (m, 0) g n = (2 * n, 2 `div` n) {-# NOINLINE g #-} in case m of 1 -> 0 2 -> snd (g m) _ -> uncurry (+) (g m) ``` Without the interleaved representation, we would just get `L` for the strictness demand on `g`. Now we are able to express that whenever `g` is called, its second component is used strictly in denoting `g` by `1C1(P(1P(U),SP(U)))`. This would allow Nested CPR to unbox the division, for example. Fixes #18903. While fixing regressions, I also discovered and fixed #18957. Metric Decrease: T13253-spj
Diffstat (limited to 'driver/utils/cwrapper.c')
0 files changed, 0 insertions, 0 deletions