RFR: 8365570: C2 fails assert(false) failed: Unexpected node in SuperWord truncation: CastII

Jasmine Karthikeyan jkarthikeyan at openjdk.org
Wed Aug 20 22:20:14 UTC 2025


On Wed, 20 Aug 2025 12:53:12 GMT, Emanuel Peter <epeter at openjdk.org> wrote:

>> Hi all,
>> This is a quick patch for the assert failure in superword truncation with CastII. I've added a check for all constraint cast nodes, and attached a reduced version of the fuzzer test. Thanks!
>
> src/hotspot/share/opto/superword.cpp line 2576:
> 
>> 2574: 
>> 2575:   // Vector nodes and casts should not truncate.
>> 2576:   if (type->isa_vect() != nullptr || type->isa_vectmask() != nullptr || in->is_Reduction() || in->is_ConstraintCast()) {
> 
> Why should we not truncate a CastII? What can go wrong?

My thinking was that since casts specifically change the type of a node, they may not be safe to truncate. In practice it might not matter because after the CastII pack is created, it's discarded because there is no backend implementation for vectorized CastII. I've opted to mark them as non-truncating to stay on the safer side.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/26827#discussion_r2289422909


More information about the hotspot-compiler-dev mailing list