RFR: 8371065: C2 SuperWord: VTransformLoopPhiNode::apply set wrong type, led to wrong constant folding of phi [v2]
Emanuel Peter
epeter at openjdk.org
Mon Nov 10 14:03:39 UTC 2025
On Sat, 8 Nov 2025 15:59:50 GMT, Quan Anh Mai <qamai at openjdk.org> wrote:
>> Emanuel Peter has updated the pull request incrementally with one additional commit since the last revision:
>>
>> add diagnostic flag for product build
>
> That may be more preferable. Or we can track the type in `VTransformLoopPhiNode` and change it when we decide to do the transformation, at the same time as other nodes in the loop? I see that `VTransformLoopPhiNode::apply` returns a `make_scalar`, which seems confusing if it can be a vector, too. Or we can have `VTransformScalarLoopPhi` and `VTransformVectorLoopPhi` as separate classes, but it seems like it will result in some unnecessary duplication.
>
> These are just suggestions, and my expertise in the superword vectorizer is definitely lacking, please make the decision that you think is best.
@merykitty In the meantime, we have had another fuzzer failure detected. Interestingly, it fails also because of the same refactoring, but for a slightly different reason. It is not about constant folding, but rather about dead nodes that are still attached to the phi. With `StressIGVN` we can get the old scalar reduction nodes to check their input, and find the new vectorized phi type. That leads to a scalar/vector type mismatch.
I'll now try to implement a `VTransformVectorLoopPhi`, which creates a new phi node, so we are sure no old nodes are attached to it.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/28113#issuecomment-3511839802
More information about the hotspot-compiler-dev
mailing list