JDK-8257575 : C2: "failed: only phis" assert failure in loop strip mining verification
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 11,16
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2020-12-02
  • Updated: 2021-03-29
  • Resolved: 2020-12-07
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 :  
Description
#  Internal Error (/home/roland/jdk-jdk/src/hotspot/share/opto/loopnode.cpp:1812), pid=1215818, tid=1215833
#  assert(outer->outcnt() >= phis + 2 && outer->outcnt() <= phis + 2 + stores + 1) failed: only phis

from a ctw run but also reproducible with:

/**
 * @test
 *
 * @run main/othervm -XX:LoopUnrollLimit=0 -XX:-UseOnStackReplacement -XX:-BackgroundCompilation -XX:CompileCommand=dontinline,TestEliminatedLoadPinnedOnBackedge::notInlined
 *                    -XX:CompileCommand=inline,TestEliminatedLoadPinnedOnBackedge::inlined TestEliminatedLoadPinnedOnBackedge
 *
 */

public class TestEliminatedLoadPinnedOnBackedge {
    private static Object field2;

    final static int iters = 2000;

    public static void main(String[] args) {
        boolean[] flags = new boolean[iters];
        for (int i = 0; i < iters; i++) {
            flags[i] = i < iters/2;
        }
        for (int i = 0; i < 20_000; i++) {
            test1(flags);
            inlined(new Object(), 1);
            inlined(new Object(), 4);
            inlined2(42);
            inlined2(0x42);
        }
    }

    static int field;

    private static int test1(boolean[] flags) {
        int k = 2;
        for (; k < 4; k *= 2) {
        }
        int[] array = new int[10];
        notInlined(array);
        int v = array[0];
        array[1] = 42;
        Object o = new Object();
        inlined(o, k);
        int i = 0;
        for (; ; ) {
            synchronized (array) {
            }
            if (i >= iters) {
                break;
            }
            v = array[0];
            if (flags[i]) {
                inlined2(array[1]);
            }
            i++;
        }
        return v;
    }
}
Comments
Fix Request Should get backported for parity with 11.0.11-oracle. Applies cleanly.
12-01-2021

Changeset: f5a582c2 Author: Roland Westrelin <roland@openjdk.org> Date: 2020-12-07 09:38:22 +0000 URL: https://git.openjdk.java.net/jdk/commit/f5a582c2
07-12-2020

ILW = Harmless assert during C2 compilation, reproducible with simple test, no workaround but disable compilation = MMM = P3
04-12-2020

Nevermind, I see review request now. It looks like a slightly different problem.
02-12-2020

It started failing after JDK-8255000 (C2: Unify IGVN processing when loop opts are over) which delayed some post-loop opts IGVN transformations and node eliminations. It led to some Phi nodes to be commoned and shared in outer loop during strip mining and triggered the assertion failure.
02-12-2020

It duplicates JDK-8255120, doesn't it?
02-12-2020