RFR: 8326135: Enhance adlc to report unused operands [v2]

Vladimir Kozlov kvn at openjdk.org
Tue Feb 20 17:11:56 UTC 2024


On Mon, 19 Feb 2024 09:37:08 GMT, kuaiwei <duke at openjdk.org> wrote:

>> Some operands are defined in adfile but no one used them. But it's hard to find them manually. So I try to enhance adlc to report them after parsing the whole adfile.
>> 
>> I added a helper Form::forms_do to recursively visit child forms. After parsing, adlc will start from all instructions to mark all used forms. And report unvisited operands as unused. By this way, I can find 44 unused operands for aarch64, 12 for x86_64 and 4 for riscv64. The report is like
>> 
>> ...
>> Warning: unused operand (vRegD_V28)
>> Warning: unused operand (vRegD_V29)
>> Warning: unused operand (vRegD_V30)
>> Warning: unused operand (vRegD_V31)
>> Warning: unused operand (lr_RegP)
>> Warning: unused operand (indOffI)
>> Warning: unused operand (indOffL)
>> Warning: unused operand (thread_anchor_pc)
>> -------Warning: total 44 unused operands
>> 
>> 
>> I tested and find they can be safely removed.
>
> kuaiwei has updated the pull request incrementally with one additional commit since the last revision:
> 
>   add newline in report

Very nice feature.

What effect it has on `adlc` run time?

src/hotspot/share/adlc/archDesc.cpp line 739:

> 737:   callback.do_form_by_name("stackSlotL");
> 738: 
> 739:   // special generic vector operands used in Matcher::pd_specialize_generic_vector_operand

What is special about `stackSlot*` and `vec*` operands to process them explicitly here?

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

PR Review: https://git.openjdk.org/jdk/pull/17910#pullrequestreview-1891004185
PR Comment: https://git.openjdk.org/jdk/pull/17910#issuecomment-1954667845
PR Review Comment: https://git.openjdk.org/jdk/pull/17910#discussion_r1496190526


More information about the hotspot-compiler-dev mailing list