The attached fuzzer test fails with the following assertion:
To reproduce:
$ java -Xcomp -XX:-TieredCompilation -XX:CompileOnly=Reduced Reduced.java
$ java -Xcomp -XX:-TieredCompilation -XX:CompileOnly=Test Test.java
#
# A fatal error has been detected by the Java Runtime Environment:
#
# Internal Error (/opt/mach5/mesos/work_dir/slaves/0f76e7b4-d512-4e9f-a839-a1d961774dea-S25478/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/60e94edb-f7fc-4e5a-a4e6-8c5edee7d585/runs/23c637d1-6b4a-4721-8ba9-95c2854c397f/workspace/open/src/hotspot/share/opto/loopnode.hpp:1091), pid=18562, tid=18576
# assert(n != __null) failed: Bad immediate dominator info.
#
# JRE version: Java(TM) SE Runtime Environment (17.0+10) (fastdebug build 17-ea+10-LTS-723)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 17-ea+10-LTS-723, compiled mode, sharing, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
# Problematic frame:
# V [libjvm.so+0x12d0d8b] PhaseIdealLoop::idom_no_update(unsigned int) const+0x16b
...........
Command Line: -Xmx1G -Xcomp -Xbatch -XX:-TieredCompilation -XX:CompileOnly=Test -XX:CompileCommand=quiet Test
...........
Current CompileTask:
C2: 313 10 % !b Test::mainTest @ 119 (698 bytes)
Stack: [0x00007f22f64f8000,0x00007f22f65f9000], sp=0x00007f22f65f2da0, free space=1003k
Native frames: (J=compiled Java code, A=aot compiled Java code, j=interpreted, Vv=VM code, C=native code)
V [libjvm.so+0x12d0d8b] PhaseIdealLoop::idom_no_update(unsigned int) const+0x16b
V [libjvm.so+0x12dd201] PhaseIdealLoop::clone_loop_handle_data_uses(Node*, Node_List&, IdealLoopTree*, IdealLoopTree*, Node_List*&, Node_List*&, Node_List*&, Node_List&, unsigned int, PhaseIdealLoop::CloneLoopMode)+0x581
V [libjvm.so+0x12debbf] PhaseIdealLoop::clone_loop(IdealLoopTree*, Node_List&, int, PhaseIdealLoop::CloneLoopMode, Node*)+0x124f
V [libjvm.so+0x12a6ddf] PhaseIdealLoop::create_slow_version_of_loop(IdealLoopTree*, Node_List&, int, PhaseIdealLoop::CloneLoopMode)+0xc3f
V [libjvm.so+0x12a8df2] PhaseIdealLoop::do_unswitching(IdealLoopTree*, Node_List&)+0x172
V [libjvm.so+0x12a162e] IdealLoopTree::iteration_split_impl(PhaseIdealLoop*, Node_List&) [clone .part.0]+0x4ce
V [libjvm.so+0x12a1bbb] IdealLoopTree::iteration_split(PhaseIdealLoop*, Node_List&)+0x13b
V [libjvm.so+0x12a1ab5] IdealLoopTree::iteration_split(PhaseIdealLoop*, Node_List&)+0x35
V [libjvm.so+0x12cec78] PhaseIdealLoop::build_and_optimize(LoopOptsMode)+0xca8
V [libjvm.so+0xa0ee9b] PhaseIdealLoop::optimize(PhaseIterGVN&, LoopOptsMode)+0x32b
V [libjvm.so+0xa0c003] Compile::Optimize()+0x14c3
V [libjvm.so+0xa0de45] Compile::Compile(ciEnv*, ciMethod*, int, bool, bool, bool, bool, DirectiveSet*)+0x1905
V [libjvm.so+0x83a02a] C2Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)+0x1ea
V [libjvm.so+0xa1dd11] CompileBroker::invoke_compiler_on_method(CompileTask*)+0xea1
V [libjvm.so+0xa1e998] CompileBroker::compiler_thread_loop()+0x5a8
V [libjvm.so+0x1840bf6] JavaThread::thread_main_inner()+0x256
V [libjvm.so+0x1847070] Thread::call_run()+0x100
V [libjvm.so+0x1533406] thread_native_entry(Thread*)+0x116