JDK-8257561 : Some code is not vectorized after 8251925 and 8250607
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 11,16
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2020-12-02
  • Updated: 2022-02-06
  • Resolved: 2020-12-03
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 11 JDK 16
11.0.11-oracleFixed 16 b28Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Description
While working on JDK-8257531 I noticed that some our tests are not vectorized after JDK-8251925:

$ java -Xbatch -XX:-TieredCompilation -XX:CICompilerCount=1 -XX:+TraceNewVectors -XX:+UseParallelGC TestComplexAddrExpr test1
 Run test1 ...
 Finished test1.

Before we had:
java -Xbatch -XX:-TieredCompilation -XX:CICompilerCount=1 -XX:+TraceNewVectors -XX:+UseParallelGC TestComplexAddrExpr test1
 Run test1 ...
new Vector node:  912  LoadVector  ===  557  784  766  [[ 764  759  754  749  690  685  632  270 ]]  @int[int:>=0]:NotNull:exact+any *, idx=10; mismatched #vectory[8]:{int} !orig=[765],[691],[633],[269] !jvms: TestComplexAddrExpr::lambda$test1$0 @ bci:18 (line 48) 0x0000000801000a18::accept @ bci:5 Streams$RangeIntSpliterator::forEachRemaining @ bci:44 (line 104)
new Vector node:  913  ReplicateI  === _  73  [[]]  #vectory[8]:{int}
new Vector node:  914  AddVI  === _  912  913  [[ 763  758  753  748  689  684  631  291 ]]  #vectory[8]:{int} !orig=[764],[690],[632],[270] !jvms: TestComplexAddrExpr::lambda$test1$0 @ bci:20 (line 48) 0x0000000801000a18::accept @ bci:5 Streams$RangeIntSpliterator::forEachRemaining @ bci:44 (line 104)
new Vector node:  915  StoreVector  ===  790  784  766  914  [[ 910  784  909 ]]  @int[int:>=0]:NotNull:exact+any *, idx=10; mismatched  Memory: @int[int:>=0]:NotNull:exact+any *, idx=10; !orig=[763],[689],[631],[291],650 !jvms: TestComplexAddrExpr::lambda$test1$0 @ bci:21 (line 48) 0x0000000801000a18::accept @ bci:5 Streams$RangeIntSpliterator::forEachRemaining @ bci:44 (line 104)
 Finished test1.

Comments
Fix Request (11u): Backporting this patch addresses a regression that causes some code to not vectorize. Patch does not apply cleanly to 11u and requires adjustments. 11u RFR: https://mail.openjdk.java.net/pipermail/jdk-updates-dev/2021-January/004621.html
13-01-2021

Changeset: 6c9482ee Author: Vladimir Kozlov <kvn@openjdk.org> Date: 2020-12-03 17:02:04 +0000 URL: https://git.openjdk.java.net/jdk/commit/6c9482ee
03-12-2020

With JDK-8250607 changes: $ java -Xbatch -XX:-TieredCompilation -XX:CICompilerCount=1 -XX:CompileThresholdScaling=0.1 -XX:+TraceNewVectors RedTest_int | grep "new Vector node" |wc 0 0 0 Without: $ java -Xbatch -XX:-TieredCompilation -XX:CICompilerCount=1 -XX:CompileThresholdScaling=0.1 -XX:+TraceNewVectors RedTest_int | grep "new Vector node" |wc 50 1560 12836
02-12-2020

I traced regression in b25 to JDK-8250607 small changes. I suggest to reverse it. With it Reduction tests in compiler/loopopts/superword/ are not vectorized at all.
02-12-2020

There was regression in JDK16 b25 too (I ran all vectorization tests with `-Xbatch -XX:+TraceNewVectors`): $ grep "new Vector node" vect_b24.log|wc 15902 391305 3329593 $ grep "new Vector node" vect_b25.log|wc 15569 382270 3253585
02-12-2020

[~kvn] My bad, I completely missed that. Good catch! Yes it should be moved out of the '(opc == Op_ConvI2L)' block.
02-12-2020

I think it was caused by incorrect last minute change: https://github.com/openjdk/jdk/pull/954/files#r517341516 Test's vectorization was restored after moving `if (invariant()) {' code back. I think Christian wanted move it under '(!is_main_loop_member(n))' but instead moved it under '(opc == Op_ConvI2L)' check.
02-12-2020