RFR: 8364757: Missing Store nodes caused by bad wiring in PhaseIdealLoop::insert_post_loop [v4]

Benoît Maillard bmaillard at openjdk.org
Tue Sep 23 08:36:31 UTC 2025


On Tue, 16 Sep 2025 08:58:45 GMT, Emanuel Peter <epeter at openjdk.org> wrote:

>> Ok, I think I have been misled by the names / comments.
>> You are really looking for the last store in the `outer_loop`. And we do have the guarantee of a linear memory graph because it is the one between `if_false` and SafePoint.
>
> I think a better method name would help a lot ;)

> What happens here if we hit an if-diamond (or more complicated), where there can be multiple memory uses, that are then merged again by a memory phi?

This actually cannot happen because of the conditions in `PhaseIdealLoop::try_move_store_after_loop`. [There](https://github.com/benoitmaillard/jdk/blob/af346054e27919bb407ece9c3b8ce206899458ca/src/hotspot/share/opto/loopopts.cpp#L1002-L1023), before moving the store, we make sure that any user of the store is either:
- the `Phi` node attached to the loop head
- outside of the loop body

This means we cannot have any branch (though we can have chains), and it guarantees that the memory subgraph is linear within the loop body.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27225#discussion_r2371576206


More information about the hotspot-compiler-dev mailing list