RFR: 8357694: RISC-V: Several IR verification tests fail when vlen=128

Dingli Zhang dzhang at openjdk.org
Mon Jul 21 02:35:25 UTC 2025


Hi,
Can you help to review this patch? Thanks!

These tests failed because with a vlen of 128, these tests generate vectors containing only two elements. However, ​​2-element reductions for INT/LONG are not profitable​​, so the compiler won't generate the corresponding reductions IR.

We can refer to here:
https://github.com/openjdk/jdk/blob/441dbde2c3c915ffd916e39a5b4a91df5620d7f3/src/hotspot/share/opto/superword.cpp#L1606-L1633

According to the explanation above, when I use `-XX:+UnlockDiagnosticVMOptions -XX:AutoVectorizationOverrideProfitability=2`, these cases passed with vlen=128.

We can fix this problem by adding the restriction of `MaxVectorSize` greater than or equal to 32 (256 bits) to these test cases.

## Test (fastdebug)
### Test on k1 and qemu (w/ RVV, vlen=128)
- compiler/vectorization/runner/LoopReductionOpTest.java
- compiler/c2/irTests/TestIfMinMax.java
- compiler/loopopts/superword/RedTest_long.java
- compiler/loopopts/superword/SumRed_Long.java
- compiler/loopopts/superword/TestGeneralizedReductions.java
- compiler/loopopts/superword/TestUnorderedReductionPartialVectorization.java

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

Commit messages:
 - 8357694: RISC-V: Several IR verification tests fail when vlen=128

Changes: https://git.openjdk.org/jdk/pull/26408/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=26408&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8357694
  Stats: 19 lines in 6 files changed: 7 ins; 0 del; 12 mod
  Patch: https://git.openjdk.org/jdk/pull/26408.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/26408/head:pull/26408

PR: https://git.openjdk.org/jdk/pull/26408


More information about the hotspot-compiler-dev mailing list