RFR: 8373495: C2: Aggressively fold loads from objects that have not escaped [v17]

Daniel Lundén dlunden at openjdk.org
Fri Jan 23 13:36:56 UTC 2026


On Fri, 16 Jan 2026 10:51:39 GMT, Daniel Lundén <dlunden at openjdk.org> wrote:

>> Quan Anh Mai has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 19 additional commits since the last revision:
>> 
>>  - Merge branch 'master' into loadfoldingigvn
>>  - Early return when not a heap access
>>  - Fix escape at store
>>  - Fix outdated and unclear comments
>>  - copyright year, return, comments, whitespace
>>  - Merge branch 'master' into loadfoldingigvn
>>  - ea of phis and nested objects
>>  - Add test scenarios
>>  - Add a flag to turn off the feature
>>  - Much more comments, refactor the data into a separate class
>>  - ... and 9 more: https://git.openjdk.org/jdk/compare/863b0237...c275e6e6
>
> src/hotspot/share/opto/memnode.cpp line 2256:
> 
>> 2254:   // the alias index stuff.  So instead, peek through Stores and IFF we can
>> 2255:   // fold up, do so.
>> 2256:   Node* prev_mem = find_previous_store(phase);
> 
> Previously, we reached here even if `!can_reshape`. We no longer do so due to the additional check above. Is this correct? If so, can you add a brief comment explaining this?

I see you added a comment here ("This performs complex analysis that requires a complete graph."), but I'm still worried that we disable optimizations that we previously performed when !can_reshape (as there was no can_reshape guard here before). Have you verified that adding the can_reshape guard here does not cause any regressions?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/28812#discussion_r2721215644


More information about the hotspot-compiler-dev mailing list