RFR: 8345485: C2 MergeLoads: merge adjacent array/native memory loads into larger load [v12]

Emanuel Peter epeter at openjdk.org
Fri May 2 10:04:51 UTC 2025


On Mon, 28 Apr 2025 13:46:46 GMT, kuaiwei <duke at openjdk.org> wrote:

>> Yes, it's the limit of this implementation. I need to find the last `combine` node which can be replaced with merged load. But if it's used by other `Or` operator. So far I can not find a good way to distinguish these two cases.
>> I may add a new `checked` flag for combine operator. For case like:
>> 
>> int x = (... merge load pattern with OR ...);
>> int y = (... merge load pattern with OR ...);
>> int z = x | y;
>> 
>> When IGVN check the `Or` in `x | y`, it's the last one of combine nodes. But it will fail to merge because `collect_merge_list` can not find a related `Load` for it. And I can mark it as `checked`. So when IGVN check the `Or` nodes in line 1 and line2. it will find the next `Or` is checked and get the right one.
>> 
>> Do you think if it is doable? Other suggestion is appreciated. Thanks.
>
> I added a flag, `_merge_memops_checked`  in `AddNode`. It will be checked when search `MergePrimitiveLoads::has_no_merge_load_combine_below()` . So these cases can be handled. And tests are added.

I responded below
https://github.com/openjdk/jdk/pull/24023#pullrequestreview-2811617778

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

PR Review Comment: https://git.openjdk.org/jdk/pull/24023#discussion_r2071389572


More information about the hotspot-compiler-dev mailing list