On Mon, 1 Jun 2026 16:25:14 GMT, Roland Westrelin <[email protected]> wrote:

>> The bug is caused by a mismatch in the way `LoadFlat` and `StoreFlat`
>> are handled in `ConnectionGraph::find_inst_mem()` and
>> `MemNode::optimize_simple_memory_chain()`. Once EA has run a first
>> time, found some value array allocations as non escaping, and removed
>> their `LoadFlat`/`StoreFlat`, igvn runs and is able to further
>> transform the memory subgraph which introduces inconsistencies that
>> are then caught the next time EA runs.
>> 
>> The fix tries to make sure `ConnectionGraph::find_inst_mem()` and
>> `MemNode::optimize_simple_memory_chain()` handle `LoadFlat` and
>> `StoreFlat` similarly.
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> Roland Westrelin has updated the pull request incrementally with one 
> additional commit since the last revision:
> 
>   review

src/hotspot/share/opto/memnode.cpp line 326:

> 324:         assert(is_strict_final_load || is_known_instance, "tested 
> above");
> 325:         // LoadFlat and StoreFlat cannot happen to strict final fields
> 326:         // LoadFlat and StoreFlat to known instances are removed at the 
> end of EA: this one is unrelated

I asked a particular LLM about this, and it thinks there could be a problem 
here because a C2_MISMATCHED StoreFlat is not removed, and EA only marks the 
fields as global escape and not the based object.  Do you agree?

-------------

PR Review Comment: 
https://git.openjdk.org/valhalla/pull/2489#discussion_r3337336500

Reply via email to