atomicModifyMutVar2# demand signature is not great
Summary
atomicModifyMutVar2#
uses its function argument only once, but that is not reflected in its demand signature.
In particular, I would expect atomicModifyMutVar2#
to have demand signature <L><LC(S,L)><L>
, but instead it has signature <L><L><L>
.
I have no idea how bad this is in practice (if at all), though I can see it leads to an extra let
binding in atomicSwapIORef
: the compiler unnecessarily floats the Box
allocation out of the lambda. Nevertheless, it seems like the sort of thing we want to be precise about.
It looks like this can be fixed by writing an explicit demand signature in primops.txt.pp
somehow?
Environment
- GHC version used: 9.6
Optional:
- Operating System:
- System Architecture: