RFR: 8347901: C2 should remove unused leaf / pure runtime calls [v2]

Emanuel Peter epeter at openjdk.org
Fri Jun 20 15:57:37 UTC 2025


On Fri, 20 Jun 2025 07:37:31 GMT, Marc Chevalier <mchevalier at openjdk.org> wrote:

>> src/hotspot/share/opto/callnode.cpp line 1335:
>> 
>>> 1333:   if (can_reshape && is_unused()) {
>>> 1334:     return make_tuple_of_input_state_and_top_return_values(phase->C);
>>> 1335:   }
>> 
>> Can you add a code comment what this does?
>
> It's better commented at the definition of `make_tuple_of_input_state_and_top_return_values` now. Let's not bloat the each call site with the same wall of text again.

Suggestion:

  if (can_reshape && is_unused()) {
    // The result is not used. We remove the call by replacing it with a tuple, that
    // is later desintegrated by the projections.
    return make_tuple_of_input_state_and_top_return_values(phase->C);
  }

I suggest this. It is short,  and allows you to quickly understand what is happening without having to go to the other side.

Alternatively, you could also rename `make_tuple_of_input_state_and_top_return_values`.

Maybe: `make_tuple_for_delayed_desintegration` ? Maybe someone has an even better idea.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25760#discussion_r2159286184


More information about the graal-dev mailing list