Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a first attempt of adding poison constants to flambda to represent arguments present in a branch and not in an other. This can arise from unboxing. For instance an example where this matter is: (it has to be compiled with
-flambda-expert-max-inlining-depth 2
)The
f
function is analysed twice: once for definition, and a second time when inlining.The first time the variant is correctly unboxed and all is well. And the branches of the switch ends in:
But the second time, the branches join the apply_result/214 and 0 and apply_result/215 and 42.
For the first round this was not a problem because the typing environment was 'hand built' by
unbox_continuation_param which didn't do that join. But the second round can't do that. Hence the
result can't be optimized when the
g
function is inlinedIn that case the 0 is replaced by a Poison constant.
A Poison constant is a new kind of constants of type Poison that is somewhat
equivalent to bottom, but not really. It is ok to have a variable of type poison in the environment,
but using its value turns into bottom. This is done by
expand_head
.That way the join of the poison and
12
here is12
which allows to propagate things further.It is not the case right now, but poison constants can also be used to track undefined variables during
Un_cps that would allow some parameter sharing.