-
Bug
-
Resolution: Duplicate
-
P4
-
9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20
-
x86, aarch64
-
generic
Recently we find a defect of post loop vectorization from a fuzzer test. After a few investigation, we created below simple case to reproduce it on CPUs with vector mask support (x86 AVX-512 or AArch64 SVE).
public class Foo {
private static int[] a = new int[100];
private static long val = 0;
private static void bar() {
int i = 0;
for (i = 3; i < 50; i++)
a[i] += 1;
val += i;
}
public static void main(String[] strArr) {
bar();
System.out.println(val);
}
}
$ java Foo
50
$ java -Xcomp -XX:+UnlockDiagnosticVMOptions -XX:CompileOnly=Foo.bar -XX:-TieredCompilation -XX:+UnlockExperimentalVMOptions -XX:+PostLoopMultiversioning Foo
47
In this case, the induction variable `i` is used after the loop and converted and added to a long. The add uses the ConvI2LNode which is not correctly incremented after loop.
public class Foo {
private static int[] a = new int[100];
private static long val = 0;
private static void bar() {
int i = 0;
for (i = 3; i < 50; i++)
a[i] += 1;
val += i;
}
public static void main(String[] strArr) {
bar();
System.out.println(val);
}
}
$ java Foo
50
$ java -Xcomp -XX:+UnlockDiagnosticVMOptions -XX:CompileOnly=Foo.bar -XX:-TieredCompilation -XX:+UnlockExperimentalVMOptions -XX:+PostLoopMultiversioning Foo
47
In this case, the induction variable `i` is used after the loop and converted and added to a long. The add uses the ConvI2LNode which is not correctly incremented after loop.
- duplicates
-
JDK-8311691 C2: Remove legacy code related to PostLoopMultiversioning
- Resolved
- relates to
-
JDK-8153998 Masked vector post loops
- Resolved