RFR: 8376220: C2: Refactor the logic to in MemNode::find_previous_store [v4]

Roberto Castañeda Lozano rcastanedalo at openjdk.org
Mon Jan 26 16:06:53 UTC 2026


On Sat, 24 Jan 2026 18:43:28 GMT, Quan Anh Mai <qamai at openjdk.org> wrote:

>> Quan Anh Mai has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Test description
>
> src/hotspot/share/opto/memnode.cpp line 1236:
> 
>> 1234:       // LoadVector/StoreVector needs additional check to ensure the types match.
>> 1235:       if (st->is_StoreVector()) {
>> 1236:         // Some kind of masked access or gather/scatter
> 
> This condition is insufficient to determine if `this` inspects the same memory as `st`. Luckily, `LoadVectorMasked`, `LoadVectorGather`, and `LoadVectorGatherMasked` all have `store_Opcode()` being `-1`, preventing any folding with them. On the other hand, `LoadVector` has `store_Opcode()` being `Op_StoreVector`, so the only case here turns out the be correct. However, it is better to be precise here.

Could you summarize this motivation in a code comment?
Is the failure that motivated this additional checks triggered by the additional capabilities of `MemNode::detect_ptr_independence`?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/29390#discussion_r2728151027


More information about the hotspot-compiler-dev mailing list