JDK-8372302 : C2 fails with Missed optimization opportunity in PhaseIterGVN
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 26
  • Priority: P4
  • Status: In Progress
  • Resolution: Unresolved
  • Submitted: 2025-11-20
  • Updated: 2025-11-24
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 27
27Unresolved
Related Reports
Relates :  
Description
After the integration of  JDK-8371674 we still see

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (/opt/mach5/mesos/work_dir/slaves/da1065b5-7b94-4f0d-85e9-a3a252b9a32e-S7293/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/b947ca5f-c1ce-4a2c-86bc-cebf8a2722a6/runs/2002624d-2289-4767-8900-3b7ff4fb52fa/workspace/open/src/hotspot/share/opto/phaseX.cpp:1105), pid=3166708, tid=3166728
#  assert(!failure) failed: Missed optimization opportunity in PhaseIterGVN
#
# JRE version: Java(TM) SE Runtime Environment (26.0+25) (fastdebug build 26-ea+25-2528)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 26-ea+25-2528, mixed mode, sharing, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
# Problematic frame:
# V  [libjvm.so+0x188e039]  PhaseIterGVN::verify_optimize()+0xd19
#
# Core dump will be written. Default location: Core dumps may be processed with "/usr/share/apport/apport -p%p -s%s -c%c -d%d -P%P -u%u -g%g -F%F -- %E" (or dumping to /tmp/fuzzer.tmp.XbQymWgnS1/core.3166708)
#
# If you would like to submit a bug report, please visit:
#   https://bugreport.java.com/bugreport/crash.jsp
#

---------------  S U M M A R Y ------------

Command Line: -Xmx1G -XX:+IgnoreUnrecognizedVMOptions -XX:CompileCommand=quiet -XX:CompileCommand=compileonly,*Test*::* -XX:-TieredCompilation -XX:+UnlockDiagnosticVMOptions -XX:StressSeed=298109268 -Xbatch -XX:+UnlockDiagnosticVMOptions -XX:+StressLCM -XX:+StressGCM -XX:+StressIGVN -XX:+StressCCP -XX:+StressMacroExpansion -XX:+StressLoopPeeling -XX:+UnlockExperimentalVMOptions -XX:PerMethodSpecTrapLimit=0 -XX:PerMethodTrapLimit=0 -XX:+VerifyLoopOptimizations -XX:VerifyIterativeGVN=1110 -XX:MaxRAMPercentage=4.16667 -Dtest.boot.jdk=/opt/mach5/mesos/work_dir/jib-master/install/jdk/25/37/bundles/linux-x64/jdk-25_linux-x64_bin.tar.gz/jdk-25 -Djava.io.tmpdir=/opt/mach5/mesos/work_dir/slaves/526fbd26-20de-495c-9a19-a04adc16f7d1-S37672/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/c169c638-a4ca-4ed7-8af6-ddde99c68eee/runs/db39beb5-74cd-407c-90e8-c3890685d5aa/testoutput/test-support/jtreg_closed_test_hotspot_jtreg_applications_javafuzzer_MediumTest_java/tmp Test

Host: ubuntu-24-04-x64-324629, AMD EPYC 7J13 64-Core Processor, 12 cores, 23G, Ubuntu 24.04.3 LTS
Time: Thu Nov 20 19:56:16 2025 UTC elapsed time: 1.097576 seconds (0d 0h 0m 1s)

---------------  T H R E A D  ---------------

Current thread (0x000079840415d010):  JavaThread "C2 CompilerThread0" daemon [_thread_in_native, id=3166728, stack(0x00007983bbf00000,0x00007983bc000000) (1024K)]


Current CompileTask:
C2:1097    4   !b        Test::vMeth (347 bytes)

Stack: [0x00007983bbf00000,0x00007983bc000000],  sp=0x00007983bbffaca0,  free space=1003k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0x188e039]  PhaseIterGVN::verify_optimize()+0xd19  (phaseX.cpp:1105)
V  [libjvm.so+0x188e8a8]  PhaseIterGVN::optimize()+0x418  (phaseX.cpp:1069)
V  [libjvm.so+0xbb43a2]  PhaseIdealLoop::optimize(PhaseIterGVN&, LoopOptsMode)+0x672  (loopnode.hpp:1344)
V  [libjvm.so+0xbadece]  Compile::Optimize()+0xafe  (compile.cpp:2468)
V  [libjvm.so+0xbb1233]  Compile::Compile(ciEnv*, ciMethod*, int, Options, DirectiveSet*)+0x2023  (compile.cpp:860)
V  [libjvm.so+0x9cc273]  C2Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)+0x4a3  (c2compiler.cpp:147)
V  [libjvm.so+0xbc0720]  CompileBroker::invoke_compiler_on_method(CompileTask*)+0x780  (compileBroker.cpp:2345)
V  [libjvm.so+0xbc1f80]  CompileBroker::compiler_thread_loop()+0x530  (compileBroker.cpp:1989)
V  [libjvm.so+0x112264b]  JavaThread::thread_main_inner()+0x13b  (javaThread.cpp:776)
V  [libjvm.so+0x1b9baf6]  Thread::call_run()+0xb6  (thread.cpp:242)
V  [libjvm.so+0x17f7848]  thread_native_entry(Thread*)+0x118  (os_linux.cpp:862)
C  [libc.so.6+0x9caa4]
Comments
I assume (but I didn't test) that this comes from the temporary hook node (I'm not sure why that is needed, but that's another topic), combined with the exit at https://github.com/openjdk/jdk/blob/master/src/hotspot/share/opto/divnode.cpp#L1147. There are more returns below (for pos_con == 1, and for powers of two with non-negative dividends) where we don't properly destruct the hook node, but in that case we don't return nullptr, so we see progress there. The same problem applies to ModL.
22-11-2025

ILW = Missed optimization in IGVN, single fuzzer case, use -XX:VerifyIterativeGVN=0 = MLM = P4
21-11-2025

[~dholmes] In the description above, you mentioned that it "still" fails even after JDK-8371674. But they are only loosely related, they fail at the same assert but not because of the same reason. JDK-8371674 was about move nodes, this seems to be about ModI. Ideal optimization did not make progress but created new unused nodes. old_unique = 3011, unique = 3012 dist dump --------------------------------------------- 1 3004 ConI === 0 [[ 2757 487 2124 2760 ]] #int:minint 1 2758 LoadI === 2080 2759 470 [[ 2757 ]] @int[int:>=0] (java/lang/Cloneable,java/io/Serializable):exact+any *, idx=6; #int !orig=472 !jvms: Test::vMeth @ bci:125 (line 87) 0 2757 ModI === _ 2758 3004 [[ 2756 ]] !orig=487 !jvms: Test::vMeth @ bci:127 (line 87)
21-11-2025