RFR: 8345485: C2 MergeLoads: merge adjacent array/native memory loads into larger load [v12]
kuaiwei
duke at openjdk.org
Mon Apr 21 11:18:52 UTC 2025
On Thu, 17 Apr 2025 09:30:56 GMT, Emanuel Peter <epeter at openjdk.org> wrote:
>> kuaiwei has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 14 commits:
>>
>> - Merge remote-tracking branch 'origin/master' into dev/merge_loads
>> - Remove unused code
>> - Move code to addnode.cpp and add more tests
>> - Merge remote-tracking branch 'origin/master' into dev/merge_loads
>> - Fix test
>> - Add more tests
>> - Enable StressIGVN and riscv platform
>> - Change tests as review comments
>> - Fix test failure and change for review comments
>> - Revert extract value and add more tests
>> - ... and 4 more: https://git.openjdk.org/jdk/compare/660b17a6...f6518b26
>
> src/hotspot/share/opto/addnode.cpp line 800:
>
>> 798: *
>> 799: * Because array value is logical and with constant 0xff/0xffff, LoadS/LoadB is converted to an unsigned load
>> 800: * and 'And' node is eliminated in previous IGVN phase. Please check AndINode::Ideal for reference
>
> What do you mean by `array value is logical`?
> Do you have tests where we do not have the `And` in the code, and there would be implicit sign extension?
I mean `array value is masked with constant 0xff/0xffff`. I will change the comment. Tests without `And operator` will be added. I think the sign extension is checked before merging.
> src/hotspot/share/opto/addnode.cpp line 828:
>
>> 826: };
>> 827:
>> 828: typedef GrowableArray<MergeLoadInfo*> MergeLoadInfoList;
>
> Do you need to have this Resource allocated? Why not just have the elements in-place? And then make the `MergeLoadInfo` a `StackObj`. That would remove the extra pointer indirection.
I choose `GrowableArray` for convenience. And it can be changed as a stack allocate data.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/24023#discussion_r2052273358
PR Review Comment: https://git.openjdk.org/jdk/pull/24023#discussion_r2052274772
More information about the hotspot-compiler-dev
mailing list