RFR: 8360192: C2: Make the type of count leading/trailing zero nodes more precise [v3]

Jasmine Karthikeyan jkarthikeyan at openjdk.org
Mon Aug 4 16:54:10 UTC 2025


On Tue, 24 Jun 2025 09:51:51 GMT, Qizheng Xing <qxing at openjdk.org> wrote:

>> src/hotspot/share/opto/countbitsnode.cpp line 61:
>> 
>>> 59:                          ti->_widen);
>>> 60:   }
>>> 61:   return TypeInt::INT;
>> 
>> Just curious, when would this fallback path be used?
>
> When someone passes a non-integer to `CountLeadingZerosINode`, I think.

Since the function filters `Type::TOP` earlier, I don't think it is possible to see non-int types here. I think it would be better to change it to `is_int()` and remove the null check, so that any broken graph constructions can be caught with the assert on the type check. You might also need to check for `Type::BOTTOM`.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25928#discussion_r2252036736


More information about the hotspot-compiler-dev mailing list