The attached testcase fails with the following assertion:
To reproduce:
$ java -Xcomp -XX:CompileOnly=Test Test.java
$ java -Xcomp -XX:CompileOnly=Reduced Reduced.java
#
# A fatal error has been detected by the Java Runtime Environment:
#
# Internal Error (/opt/mach5/mesos/work_dir/slaves/ff806ead-2cac-495d-9cbc-62116f99bf14-S13890/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/e1985841-cb1f-4767-b2e4-927825614993/runs/9fce6d83-2b2c-4178-b4c4-97cbe003ff2d/workspace/open/src/hotspot/share/opto/loopPredicate.cpp:888), pid=18540, tid=18553
# assert(f <= 1 && f >= 0) failed: Incorrect frequency
#
# JRE version: Java(TM) SE Runtime Environment (17.0+35) (fastdebug build 17+35-LTS-2724)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 17+35-LTS-2724, compiled mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
# Problematic frame:
# V [libjvm.so+0x12df66d] PathFrequency::to(Node*)+0xc2d
..........
Command Line: -Xmx1G -Xcomp -Xbatch -XX:CompileOnly=Test -XX:CompileCommand=quiet Test
..........
Current thread (0x00007fa02c4821a0): JavaThread "C2 CompilerThread0" daemon [_thread_in_native, id=18553, stack(0x00007fa0056ff000,0x00007fa005800000)]
Current CompileTask:
C2: 1524 71 !b 4 Test::mainTest (2044 bytes)
Stack: [0x00007fa0056ff000,0x00007fa005800000], sp=0x00007fa0057f9d60, free space=1003k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V [libjvm.so+0x12df66d] PathFrequency::to(Node*)+0xc2d
V [libjvm.so+0x12da934] PhaseIdealLoop::loop_predication_follow_branches(Node*, IdealLoopTree*, float, PathFrequency&, Node_Stack&, VectorSet&, Node_List&)+0x574
V [libjvm.so+0x12dbd12] PhaseIdealLoop::loop_predication_impl(IdealLoopTree*) [clone .part.0]+0x1192
V [libjvm.so+0x12dc259] IdealLoopTree::loop_predication(PhaseIdealLoop*)+0x109
V [libjvm.so+0x12dc195] IdealLoopTree::loop_predication(PhaseIdealLoop*)+0x45
V [libjvm.so+0x12dc195] IdealLoopTree::loop_predication(PhaseIdealLoop*)+0x45
V [libjvm.so+0x12dc178] IdealLoopTree::loop_predication(PhaseIdealLoop*)+0x28
V [libjvm.so+0x12dc195] IdealLoopTree::loop_predication(PhaseIdealLoop*)+0x45
V [libjvm.so+0x12dc195] IdealLoopTree::loop_predication(PhaseIdealLoop*)+0x45
V [libjvm.so+0x12dc195] IdealLoopTree::loop_predication(PhaseIdealLoop*)+0x45
V [libjvm.so+0x132487f] PhaseIdealLoop::build_and_optimize(LoopOptsMode)+0x11cf
V [libjvm.so+0xa377da] PhaseIdealLoop::optimize(PhaseIterGVN&, LoopOptsMode)+0x2da
V [libjvm.so+0xa340f5] Compile::Optimize()+0x14f5
V [libjvm.so+0xa35c78] Compile::Compile(ciEnv*, ciMethod*, int, bool, bool, bool, bool, bool, DirectiveSet*)+0x1618
V [libjvm.so+0x84b116] C2Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)+0x646
V [libjvm.so+0xa45cc1] CompileBroker::invoke_compiler_on_method(CompileTask*)+0xb71
V [libjvm.so+0xa46968] CompileBroker::compiler_thread_loop()+0x5a8
V [libjvm.so+0x18dca01] JavaThread::thread_main_inner()+0x271
V [libjvm.so+0x18e3ff0] Thread::call_run()+0x100
V [libjvm.so+0x15a9cf4] thread_native_entry(Thread*)+0x104