Both MergeMemNodes should not be modified, currently mm2 is const, but mm is mutable.
The problem is that modification is not really expected. [~thartmann] and I have found places in the code where mm is modified. But the node is never added to igvn worklist.
This lead to issues inJDK-8255670 where I check if all modified nodes end up on the igvn worklist. So I had to ad hoc add the nodes to the igvn worklist - this is not a very nice solution.
A better solution: Make sure we can stream over the two MergeMem nodes, and when the lengths are not identical to simply return empty_memory nodes where we are out of bounds (maybe it is a little more complicated, this is only a first guess).
The problem is that modification is not really expected. [~thartmann] and I have found places in the code where mm is modified. But the node is never added to igvn worklist.
This lead to issues in
A better solution: Make sure we can stream over the two MergeMem nodes, and when the lengths are not identical to simply return empty_memory nodes where we are out of bounds (maybe it is a little more complicated, this is only a first guess).