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

Quan Anh Mai qamai at openjdk.org
Sat Dec 13 02:53:57 UTC 2025


On Fri, 12 Dec 2025 22:19:46 GMT, Vladimir Ivanov <vlivanov 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 seven additional commits since the last revision:
>> 
>>  - Merge branch 'master' into foldmem
>>  - grammar, safe change
>>  - more detailed explanations
>>  - store values need normalizing
>>  - Just use candidate_set directly
>>  - Some runtime calls may receive a derived pointer but not the base
>>  - Aggressively fold loads from objects that have not escaped
>
> Speaking of the general approach, if analysis part turns out to be way too
> expensive for IGVN, I'd still prefer to have the analysis and transformation to be
> separated and IGVN used to conduct the actual IR changes.
> 
> There's already some duplication and divergence between IGVN & `PhaseLoadFolding`
> implementation. Without proper care, it can easily get worse in the future.
> 
> Another thing to consider: it's beneficial to perform such transformation
> earlier, as IGVN case illustrates. (For example, by the time EA kicks in,
> inlining is over.) Shared implementation is easier to maintain and reuse.

@iwanowww Thanks for your analysis, I think it is possible to do the transformation during IGVN and have created another PR which follows that approach, could you take a look?

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

PR Comment: https://git.openjdk.org/jdk/pull/28764#issuecomment-3648796355


More information about the hotspot-compiler-dev mailing list