RFR: 8360192: C2: Make the type of count leading/trailing zero nodes more precise [v7]
Qizheng Xing
qxing at openjdk.org
Thu Aug 7 02:18:18 UTC 2025
On Wed, 6 Aug 2025 12:38:05 GMT, Quan Anh Mai <qamai at openjdk.org> wrote:
>> Qizheng Xing has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains nine additional commits since the last revision:
>>
>> - Merge branch 'master' into enhance-clz-type
>> - Add checks for results of all test methods
>> - Replace `isa_*` with `is_*` and add checks for `Type::BOTTOM`
>> - Merge branch 'master' into enhance-clz-type
>> - Move `TestCountBitsRange` to `compiler.c2.gvn`
>> - Fix null checks
>> - Narrow type bound
>> - Use `BitsPerX` constant instead of `sizeof`
>> - Make the type of count leading/trailing zero nodes more precise
>
> src/hotspot/share/opto/countbitsnode.cpp line 50:
>
>> 48: //------------------------------Value------------------------------------------
>> 49: const Type* CountLeadingZerosINode::Value(PhaseGVN* phase) const {
>> 50: // If the input is TOP, the result is also TOP.
>
> IMO this comment is unnecessary, it is trivial to infer from the code below.
Removed.
> src/hotspot/share/opto/countbitsnode.cpp line 62:
>
>> 60:
>> 61: const TypeInt* ti = t->is_int();
>> 62: if (ti->is_con()) {
>
> This is unnecessary, if `ti` is a constant then `~ti->_bits._zeros == ti->_bits._ones` and the below case will return a constant anyway.
Removed, and added tests for constant input CLZ/CTZ nodes.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25928#discussion_r2258707369
PR Review Comment: https://git.openjdk.org/jdk/pull/25928#discussion_r2258709866
More information about the hotspot-compiler-dev
mailing list