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

Tobias Hartmann thartmann at openjdk.org
Thu Dec 18 15:25:20 UTC 2025


On Thu, 18 Dec 2025 13:56:11 GMT, Manuel Hässig <mhaessig 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/inlinetypenode.cpp line 675:
> 
>> 673: bool InlineTypeNode::can_emit_substitutability_check(Node* other) const {
>> 674:   if (other != nullptr && other->is_InlineType() && bottom_type() != other->bottom_type()) {
>> 675:     // Different types, this is dead code because there's a check above that guarantees this.
> 
> Shouldn't this be an assert, then? Or at least call it a sanity check instead, just so no one gets an idea and removes it when they have not realized yet that the bottom type check is essential for the rest of the method.

Maybe I'm misunderstanding your comment but with "dead code" I meant that the IR will be folded but didn't fold yet. We still need the checks in the C++ code to avoid optimizing dead code during IGVN (we would need all kinds of is_top checks further below).

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

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


More information about the valhalla-dev mailing list