[lworld] RFR: 8228361: [lworld] Optimize the substitutability check in C2 [v3]

Tobias Hartmann thartmann at openjdk.org
Thu Dec 18 13:42:24 UTC 2025


On Thu, 18 Dec 2025 12:24:35 GMT, Christian Hagedorn <chagedorn at openjdk.org> wrote:

>> Tobias Hartmann has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Adjustments according to review comments
>
> src/hotspot/share/opto/subnode.cpp line 1219:
> 
>> 1217:     // If one operand is an inline type, convert this to a "both operands are null" check:
>> 1218:     //   CmpL(OrL(CastP2X(..), CastP2X(..)), 0L)
>> 1219:     // CmpLNode::Ideal might optimize this further to avoid keeping buffer allocations alive.
> 
> Why is this possible?

As we discussed off-thread, this relies on CmpP being a buffer oop pointer comparison and since there are no guarantees that such pointers are equivalent, we can convert the check. I improved the comment and hopefully it's easier to follow now.

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

PR Review Comment: https://git.openjdk.org/valhalla/pull/1823#discussion_r2631145191


More information about the valhalla-dev mailing list