RFR: 8313345: SuperWord fails due to CMove without matching Bool pack

Emanuel Peter epeter at openjdk.org
Tue Aug 8 16:47:32 UTC 2023


On Tue, 8 Aug 2023 10:50:19 GMT, Tobias Hartmann <thartmann at openjdk.org> wrote:

> SuperWord fails after [JDK-8306302](https://bugs.openjdk.org/browse/JDK-8306302), when trying to convert `Bool + Cmp + CMove` packs into `VectorMaskCmp + VectorBlend` because it does not find the `Bool` (and `Cmp`) packs for a `CMoveD`:
> 
> 
> After filter_packs
> packset
> Pack: 0
>  align: 0 	 674  StoreD  === 691 695 678 675  [[ 669 672 ]]  @double[int:>=0] (java/lang/Cloneable,java/io/Serializable):exact+any *, idx=8;  Memory: @double[int:>=0] (java/lang/Cloneable,java/io/Serializable):NotNull:exact+any *, idx=8; !orig=603,364,300 !jvms: Reproducer2$A::fill @ bci:17 (line 16)
>  align: 8 	 669  StoreD  === 691 674 673 670  [[ 603 606 ]]  @double[int:>=0] (java/lang/Cloneable,java/io/Serializable):exact+any *, idx=8;  Memory: @double[int:>=0] (java/lang/Cloneable,java/io/Serializable):NotNull:exact+any *, idx=8; !orig=364,300 !jvms: Reproducer2$A::fill @ bci:17 (line 16)
>  align: 16 	 603  StoreD  === 691 669 607 604  [[ 367 364 ]]  @double[int:>=0] (java/lang/Cloneable,java/io/Serializable):exact+any *, idx=8;  Memory: @double[int:>=0] (java/lang/Cloneable,java/io/Serializable):NotNull:exact+any *, idx=8; !orig=364,300 !jvms: Reproducer2$A::fill @ bci:17 (line 16)
>  align: 24 	 364  StoreD  === 691 603 368 428  [[ 695 363 514 ]]  @double[int:>=0] (java/lang/Cloneable,java/io/Serializable):exact+any *, idx=8;  Memory: @double[int:>=0] (java/lang/Cloneable,java/io/Serializable):NotNull:exact+any *, idx=8; !orig=300 !jvms: Reproducer2$A::fill @ bci:17 (line 16)
> Pack: 1
>  align: 0 	 677  LoadD  === 525 695 678  [[ 675 676 676 ]]  @double[int:>=0] (java/lang/Cloneable,java/io/Serializable):exact+any *, idx=8; #double !orig=606,367,193 !jvms: Reproducer2$A::fill @ bci:13 (line 16)
>  align: 8 	 672  LoadD  === 525 674 673  [[ 670 671 671 ]]  @double[int:>=0] (java/lang/Cloneable,java/io/Serializable):exact+any *, idx=8; #double !orig=367,193 !jvms: Reproducer2$A::fill @ bci:13 (line 16)
>  align: 16 	 606  LoadD  === 525 669 607  [[ 604 605 605 ]]  @double[int:>=0] (java/lang/Cloneable,java/io/Serializable):exact+any *, idx=8; #double !orig=367,193 !jvms: Reproducer2$A::fill @ bci:13 (line 16)
>  align: 24 	 367  LoadD  === 525 603 368  [[ 366 366 428 ]]  @double[int:>=0] (java/lang/Cloneable,java/io/Serializable):exact+any *, idx=8; #double !orig=193 !jvms: Reproducer2$A::fill @ bci:13 (line 16)
> Pack: 2
>  align: 0 	 675  CMoveD  === _ 327 676 677  [[ 674 ]]  #double !orig=604,428,[393],278 !jvms: Reproducer2$A::fill @ bci:14 (line 16)
>  align: 8 	 670  CMoveD  === _ 327 671 672  [...

Thanks @TobiHartmann for fixing this. This is exactly what I was planning to do, either reject it in the implementable or profitable check. And yes, we need to disentangle the profitability and all the correctness checks in the future, I plan to take that up after a few other items.

About `do_reserve_copy`. The idea is that we make a whole copy of the loop and can swap that back in if there are issues during output. Not sure why that did not work in your case exactly. But my proposal is that we should not do the copy, it is an unnecessary overhead. All correctness and profitability checks are to be run before output. So if any assumption is violated in output, that would be a bug. We could still bail out of compilation, but bailing out of SuperWord would not be possible as the graph is already partially modified.

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

Marked as reviewed by epeter (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/15189#pullrequestreview-1567736814


More information about the hotspot-compiler-dev mailing list