Flambda could certainly benefit from some better CSE (well alias optimisation is some kind of CSE in fact) in inline_and_simplify (or another pass, but putting it there allow to count that in the benefit).
In particular, this may allow to share immutable block allocations that the low level CSE couldn't handle.
We could even get rid of this allocation in:
let f = function None -> None | Some (x, y) -> Some (x, y)
This would require the getfield primitive or the pattern matching to be annotated with the whole shape information of the original block to know that the output one is effectively the same.
Flambda could certainly benefit from some better CSE (well alias optimisation is some kind of CSE in fact) in inline_and_simplify (or another pass, but putting it there allow to count that in the benefit). In particular, this may allow to share immutable block allocations that the low level CSE couldn't handle.
We could even get rid of this allocation in:
This would require the getfield primitive or the pattern matching to be annotated with the whole shape information of the original block to know that the output one is effectively the same.