RFR: 8371146: C2 SuperWord: VTransform::add_speculative_check uses pre_init that is pinned after Auto_Vectorization_Check, leading to bad graph
Emanuel Peter
epeter at openjdk.org
Wed Nov 26 08:01:53 UTC 2025
On Wed, 26 Nov 2025 07:58:18 GMT, Emanuel Peter <epeter at openjdk.org> wrote:
>> src/hotspot/share/opto/vectorization.hpp line 281:
>>
>>> 279: // but the early ctrl is before the predicate.
>>> 280: Node* n_early = phase()->compute_early_ctrl(n, n_ctrl);
>>> 281: return phase()->is_dominator(n_early, check_ctrl);
>>
>> Here, ctrl is too far down but we have a valid early ctrl. Where do update ctrl (i.e. `set_ctrl()`) of `n` to a valid ctrl when you use it for the speculative check?
>
> I suppose I don't. Do you think I have to? What about all the inputs of `n`? Those may also have a ctrl that is too low now. So if you want consistency we would have to fix up everything up the chain... :/
>
> But I think this issue is not limited to the new `is_available_for_speculative_check`, but already existed for the much older `is_pre_loop_invariant`, which also uses `compute_early_ctrl`. So the problem is a little bigger, if it is really a problem at all - it may well be a problem.
>
> Suggestion:
> - We leave the fix as is. It is at least a step in the right direction.
> - We enhance our loop-opts verification, and verify ctrl after SuperWord. Then we will discover that a lot of the ctrl is set inaccurately, and fix it. That way we can also have confidence that the fix is correct. If we did the fix now, without verification, this would just be a blind stab in the dark kind of fix ;)
>
> What do you think?
It would be continued work from this RFE: https://bugs.openjdk.org/browse/JDK-8307982
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/28449#discussion_r2563814576
More information about the hotspot-compiler-dev
mailing list