RFR: 8347901: C2 should remove unused leaf / pure runtime calls [v2]
Marc Chevalier
mchevalier at openjdk.org
Mon Jun 23 07:59:33 UTC 2025
On Fri, 20 Jun 2025 15:53:59 GMT, Emanuel Peter <epeter at openjdk.org> wrote:
>> src/hotspot/share/opto/divnode.cpp line 1522:
>>
>>> 1520: if (!can_reshape) {
>>> 1521: return nullptr;
>>> 1522: }
>>
>> Would this prevent us from doing the `make_tuple_of_input_state_and_top_return_values` trick? Because it seems to me that we do not need to reshape the node for that, right? Maybe you should reorder things for that?
>
> Also, you should probably call `CallLeafPureNode::Ideal` instead of duplicating its logic here and in other subclasses.
In an earlier issue ([JDK-8349523](https://bugs.openjdk.org/browse/JDK-8349523)), I tried to remove these nodes during parsing. It didn't work well. The problem is that it's transformed by GVN before setting any output projection, so of course, the node is removing itself before having the opportunity of being used. We wait until usages have been set before we try to remove the node (or replace it with a tuple).
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25760#discussion_r2160959373
More information about the graal-dev
mailing list