(synopsis is provisional, until the root cause is found)
Note: this happens even after JDK-8229483, which does not make it duplicate of that issue. Also, there is similar thing seen in valhalla, JDK-8230798.
Found with fuzzing. Reliably reproduces with the attached testcase (0021.tar.gz). Also seen to happen in 11.
# Internal Error (/home/shade/trunks/jdk-jdk/src/hotspot/share/opto/loopnode.cpp:4269), pid=2722, tid=2733
# Error: ShouldNotReachHere()
#
# JRE version: OpenJDK Runtime Environment (14.0) (fastdebug build 14-internal+0-adhoc.shade.jdk-jdk)
# Java VM: OpenJDK 64-Bit Server VM (fastdebug 14-internal+0-adhoc.shade.jdk-jdk, mixed mode, sharing, tiered, compressed oops, g1 gc, linux-amd64)
# Problematic frame:
# V [libjvm.so+0x120657c] PhaseIdealLoop::verify_strip_mined_scheduling(Node*, Node*)+0x3cc
--------------- T H R E A D ---------------
Current thread (0x00007fdf28592000): JavaThread "C2 CompilerThread0" daemon [_thread_in_native, id=2733, stack(0x00007fdeb856a000,0x00007fdeb866b000)]
Current CompileTask:
C2: 785 79 ! 4 Test::vMeth1 (203 bytes)
Stack: [0x00007fdeb856a000,0x00007fdeb866b000], sp=0x00007fdeb8665200, free space=1004k
Native frames: (J=compiled Java code, A=aot compiled Java code, j=interpreted, Vv=VM code, C=native code)
V [libjvm.so+0x120657c] PhaseIdealLoop::verify_strip_mined_scheduling(Node*, Node*)+0x3cc
V [libjvm.so+0x12099e2] PhaseIdealLoop::build_loop_late_post_work(Node*, bool)+0x362
V [libjvm.so+0x1209f60] PhaseIdealLoop::build_loop_late(VectorSet&, Node_List&, Node_Stack&)+0xf0
V [libjvm.so+0x120dc3a] PhaseIdealLoop::build_and_optimize(LoopOptsMode)+0x74a
V [libjvm.so+0x9c94d1] PhaseIdealLoop::optimize(PhaseIterGVN&, LoopOptsMode)+0x2c1
V [libjvm.so+0x9c6388] Compile::Optimize()+0x9d8
V [libjvm.so+0x9c7bf5] Compile::Compile(ciEnv*, C2Compiler*, ciMethod*, int, bool, bool, bool, DirectiveSet*)+0x1205
V [libjvm.so+0x812a4d] C2Compiler::compile_method(ciEnv*, ciMethod*, int, DirectiveSet*)+0x10d
V [libjvm.so+0x9d3d97] CompileBroker::invoke_compiler_on_method(CompileTask*)+0x397
V [libjvm.so+0x9d4f18] CompileBroker::compiler_thread_loop()+0x4f8
V [libjvm.so+0x1833e6a] JavaThread::thread_main_inner()+0x26a
V [libjvm.so+0x183bc3b] JavaThread::run()+0x25b
V [libjvm.so+0x18393d6] Thread::call_run()+0xf6
V [libjvm.so+0x143776e] thread_native_entry(Thread*)+0x10e