On Wed, 18 Mar 2026 02:43:41 GMT, Xiaohong Gong <[email protected]> wrote:

>> src/hotspot/cpu/aarch64/aarch64.ad line 2687:
>> 
>>> 2685:       VectorNode::is_all_ones_vector(m)) {
>>> 2686:     // Check whether n is only used by an AndVMask node.
>>> 2687:     if (n->outcnt() == 1) {
>> 
>> This is not something for this PR, but could this optimization also apply if 
>> the mask was used by more than one node? Is this something that could be 
>> done as a follow up? Or would it not work at all? If it doesn't make doing 
>> so it might be worth adding a comment for future readers?
>
> I'm not so clear what the pointed `mask` means here?
> 
> If the mask is the result of `XorVMask`. If it is used by more than one node, 
> I don't think its input `MaskAll` should be cloned. Otherwise, the duplicated 
> `machnode` for `MaskAll` will be generated while the backend match rule is 
> not matched successfully because the child `XorVMask` is not single used. 
> This is just the issue that we want to fix here.
> 
> If the mask is `MaskAll` (the all ones vector). If it is used by more than 
> one node beyond the `AndNot` pattern, the backend match still will not fire 
> because the matcher will mark `MaskAll` as shared. `pd_clone_node()` cannot 
> handle such cases at the moment. I investigated how to fix this in the 
> matcher, but the solution would add noticeable complexity, which does not 
> seem worthwhile given the limited benefit, consider `MaskAll` is a loop 
> invariant operation. Therefore, I’d prefer to keep the current behavior, but 
> adding a comment here makes sense to me.

Added a comment before this method. Thanks!

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

PR Review Comment: https://git.openjdk.org/jdk/pull/30013#discussion_r2958245847

Reply via email to