JDK-8288941 : C2: assert(false) failed: Bad graph detected in build_loop_late
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 19,20
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • Submitted: 2022-06-22
  • Updated: 2022-07-05
  • Resolved: 2022-06-22
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 19
19Resolved
Related Reports
Duplicate :  
Relates :  
Relates :  
Relates :  
Description
The attached Java Fuzzer test starts to fail after JDK-8286182 which was just a backout of an RFE (JDK-8284742) which was pushed in b20. However, the Java Fuzzer test does not reproduce with b19. This suggests that a changeset since b20 has either introduced a new bug or has revealed an existing issue. It could also be a duplicate of JDK-8283386 which fails with the same assertion but is very hard to reproduce.

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/779adf21-f3e5-4e6a-a889-8cc0f9bc6fbb-S66862/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/e7a5f059-99c2-4c80-b089-a6e1a468a184/runs/f86e41f7-d216-4fe3-8825-70c90f059250/workspace/open/src/hotspot/share/opto/loopnode.cpp:5856), pid=9638, tid=9651
#  assert(false) failed: Bad graph detected in build_loop_late
#
# JRE version: Java(TM) SE Runtime Environment (19.0+25) (fastdebug build 19-ea+25-1892)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 19-ea+25-1892, compiled mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
# Problematic frame:
# V  [libjvm.so+0x1498537]  PhaseIdealLoop::build_loop_late_post_work(Node*, bool)+0x187
..........
Command Line: -Xcomp -XX:CompileOnly=Test -XX:CompileCommand=quiet --add-modules=ALL-DEFAULT jdk.compiler/com.sun.tools.javac.launcher.Main Test.java
..........
Current CompileTask:
C2:   2281  117 % !b  4       Test::mainTest @ 226 (775 bytes)

Stack: [0x00007fc5b0121000,0x00007fc5b0222000],  sp=0x00007fc5b021bf80,  free space=1003k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0x1498537]  PhaseIdealLoop::build_loop_late_post_work(Node*, bool)+0x187
V  [libjvm.so+0x1498cf2]  PhaseIdealLoop::build_loop_late(VectorSet&, Node_List&, Node_Stack&)+0xb2
V  [libjvm.so+0x1499787]  PhaseIdealLoop::build_and_optimize()+0x617
V  [libjvm.so+0xae252a]  PhaseIdealLoop::optimize(PhaseIterGVN&, LoopOptsMode)+0x27a
V  [libjvm.so+0xaded57]  Compile::Optimize()+0x1027
V  [libjvm.so+0xae0ee0]  Compile::Compile(ciEnv*, ciMethod*, int, Options, DirectiveSet*)+0x1520
V  [libjvm.so+0x8f826a]  C2Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)+0x62a
V  [libjvm.so+0xaef9a8]  CompileBroker::invoke_compiler_on_method(CompileTask*)+0xbb8
V  [libjvm.so+0xaf0998]  CompileBroker::compiler_thread_loop()+0x6f8
V  [libjvm.so+0x1a6c1ac]  JavaThread::thread_main_inner()+0x23c
V  [libjvm.so+0x1a77690]  Thread::call_run()+0x100
V  [libjvm.so+0x1729454]  thread_native_entry(Thread*)+0x104
Comments
Attached another similar test (Reduced2.java): $ java -Xcomp -XX:CompileOnly=Reduced2 Reduced2.java
05-07-2022

This is another case of where we are missing skeleton predicates. This time, we are removing the empty predicates (Conv2B/Opaque1) in Compile::cleanup_loop_predicates and afterwards we are applying loop unswitching + pre/main/post + unrolling. Since we've removed the empty predicates, we cannot find the skeleton predicates anymore and we are not copying them to the unswitched loop and eventually to the main loop. The redesign of the skeleton predicates should fix this (JDK-8288981). I'm therefore closing this a duplicate of it.
22-06-2022

ILW = Bad graph assertion in C2, single Java fuzzer test, possibly disable compilation of affected method = HLM = P3
22-06-2022