RFR: 8350177: C2 SuperWord: Integer.numberOfLeadingZeros, numberOfTrailingZeros, reverse and bitCount have input types wrongly turncated for byte and short [v3]

Emanuel Peter epeter at openjdk.org
Mon Jun 16 06:11:33 UTC 2025


On Mon, 16 Jun 2025 05:59:00 GMT, Emanuel Peter <epeter at openjdk.org> wrote:

>> Jasmine Karthikeyan has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Add assert for unexpected node in truncation
>
> src/hotspot/share/opto/superword.cpp line 2521:
> 
>> 2519:   if (VectorNode::is_shift_opcode(opc)) {
>> 2520:     return false;
>> 2521:   }
> 
> Is right shift also not truncatable? Can you add a comment why?

Here you did a return in assert.

> src/hotspot/share/opto/superword.cpp line 2538:
> 
>> 2536:     break;
>> 2537:   default:
>> 2538:     assert(false, "Unexpected node: %s", NodeClassNames[in->Opcode()]);
> 
> Suggestion:
> 
>     // If this assert it hit, that means that we need to determine if the node can be safely truncated,
>     // and then add it to the list of truncatable nodes or the list of non-truncatable ones just above.
>     // In product, we just return false, which is always correct.
>     assert(false, "Unexpected node: %s", NodeClassNames[in->Opcode()]);

I'm fairly sure that we will hit this assert with a fuzzer or some other RFE soon, and then it will be nice to know quickly what kind of failure we have here.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25440#discussion_r2149109714
PR Review Comment: https://git.openjdk.org/jdk/pull/25440#discussion_r2149115247


More information about the hotspot-compiler-dev mailing list