RFR: 8376220: C2: Refactor the logic to in MemNode::find_previous_store [v4]
Quan Anh Mai
qamai at openjdk.org
Sat Jan 31 15:51:07 UTC 2026
On Mon, 26 Jan 2026 15:47:31 GMT, Roberto Castañeda Lozano <rcastanedalo at openjdk.org> wrote:
>> 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`?
I have done that, the motivation is actually that this piece forgets that `this` can also be a `Store`, which will crash the VM at `as_LoadVector()`
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/29390#discussion_r2749689602
More information about the hotspot-compiler-dev
mailing list