RFR: 8371603: C2: assert(_inputs.at(alias_idx) == nullptr || _inputs.at(alias_idx) == load->in(1)) failed

Xiaohong Gong xgong at openjdk.org
Thu Dec 4 10:28:00 UTC 2025


On Thu, 4 Dec 2025 10:16:32 GMT, Xiaohong Gong <xgong at openjdk.org> wrote:

>> src/hotspot/share/opto/vectornode.cpp line 1118:
>> 
>>> 1116:   if (Matcher::vector_needs_partial_operations(this, vt)) {
>>> 1117:     return VectorNode::gen_masked_vector(phase, this, vt);
>>> 1118:   }
>> 
>> I think it would still be good practice to expect that a `nullptr` could come from `gen_masked_vector`, and then continue with optimizations below, rather than just returning the `nullptr`.
>> 
>> Because: who knows what someone in the future might do inside `gen_masked_vector`, maybe they'll find some edge case and just return `nullptr` again, and then we are back to similar issues.
>
> I see your concern. Make sense to me. Thanks! I'd like keep current implementation of `Matcher::vector_needs_partial_operations` and `gen_masked_vector` because as we discussed in the previous PR that this sounds more reasonable. 
> 
> I will update the caller code here to check `nullptr` in addition although it won't generate a `nullptr` now. Code may look like:
> 
> if (Matcher::vector_needs_partial_operations(this, vt)) {
>     Node* n = VectorNode::gen_masked_vector(phase, this, vt);
>     if (n != nullptr) {
>       return n;
>     }
>  }
> return ...

Is it better that we add an assertion of non `nullptr` value before returning in `gen_masked_vector` , consider this might make the caller code clean?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/28651#discussion_r2588435959


More information about the hotspot-compiler-dev mailing list