RFR: 8370863: VectorAPI: Optimize the VectorMaskCast chain in specific patterns [v6]

Jatin Bhateja jbhateja at openjdk.org
Mon Dec 15 07:40:53 UTC 2025


On Mon, 15 Dec 2025 06:52:22 GMT, Eric Fang <erfang at openjdk.org> wrote:

>> src/hotspot/share/opto/vectornode.cpp line 1063:
>> 
>>> 1061:       break;
>>> 1062:     }
>>> 1063:     assert(n->as_Vector()->length() == in1->as_Vector()->length(), "vector length must match");
>> 
>> While assertions are good to add, but mask cast is a lanewise operation, i.e. length compatibility is implied, and adding an assertion for IR invariants is redundant.
>
> My main concern here is that the requirement for `VectorMaskCastNode` to have the same length for both input and output might have been removed in the future. I'm not sure, but we do require the lengths to be the same here, so I added this assertion. @eme64  has a similar comment; see https://github.com/openjdk/jdk/pull/28313/changes#r2614577536. So, if you all think that the requirement for lane length in `VectorMaskCastNode` won't be removed, then we can delete this assertion and the condition below.

I think assertion here is redundant.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/28313#discussion_r2618311660


More information about the hotspot-compiler-dev mailing list