JDK-8361700 : Missed optimization in PhaseIterGVN for mask and shift patterns due to missing notification in PhaseIterGVN::add_users_of_use_to_worklist
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 26
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2025-07-09
  • Updated: 2025-11-10
  • Resolved: 2025-07-21
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 26
26 b08Fixed
Related Reports
Relates :  
Description
The attached Java Fuzzer test fails with a missed IGVN optimization opportunity (please update the affected versions once the root cause is known):

To reproduce:
$ java -XX:CompileCommand=compileonly,*Test*::* -Xcomp -XX:VerifyIterativeGVN=1110 Test.java
$ java -XX:CompileCommand=compileonly,*Reduced*::* -Xcomp -XX:VerifyIterativeGVN=1110 Reduced.java


Missed Ideal optimization (can_reshape=false):
The node was replaced by Ideal.
Old node:
dist dump
---------------------------------------------
   1   43  ConI  === 0  [[ 336 113 113 102 108 97 102 75 80 80 86 91 91 383 ]]  #int:1
   1  337  AndI  === _ 338 22  [[ 336 ]]  !orig=[285],[229] !jvms: Test::test @ bci:43 (line 17)
   0  336  RShiftI  === _ 337 43  [[ 343 ]]  !orig=[284],[230] !jvms: Test::test @ bci:47 (line 18)
The result after Ideal:
dist dump
---------------------------------------------
   1  384  ConI  === 0  [[ 385 ]]  #int:-9
   1  383  RShiftI  === _ 338 43  [[ 385 ]] 
   0  385  AndI  === _ 383 384  [[ ]] 


Missed Ideal optimization (can_reshape=true):
The node was replaced by Ideal.
Old node:
dist dump
---------------------------------------------
   1   43  ConI  === 0  [[ 336 113 113 102 108 97 102 75 80 80 86 91 91 383 ]]  #int:1
   1  337  AndI  === _ 338 22  [[ 336 ]]  !orig=[285],[229] !jvms: Test::test @ bci:43 (line 17)
   0  336  RShiftI  === _ 337 43  [[ 343 ]]  !orig=[284],[230] !jvms: Test::test @ bci:47 (line 18)
The result after Ideal:
dist dump
---------------------------------------------
   1  384  ConI  === 0  [[ 385 387 ]]  #int:-9
   1  383  RShiftI  === _ 338 43  [[ 385 387 ]]  !orig=[386]
   0  387  AndI  === _ 383 384  [[ ]] 

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (/opt/mach5/mesos/work_dir/slaves/08c2661b-13a6-4cd6-b5ac-ec0dc0a660b1-S15985/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/6f359eff-4690-4467-8d41-a53872b18d35/runs/e03189c9-7042-44f3-87c8-65626beff05b/workspace/open/src/hotspot/share/opto/phaseX.cpp:1105), pid=93252, tid=93270
#  assert(!failure) failed: Missed optimization opportunity in PhaseIterGVN
..............
Command Line: -Xmx1G -XX:+IgnoreUnrecognizedVMOptions -XX:CompileCommand=quiet -XX:CompileCommand=compileonly,*Test*::* -XX:-TieredCompilation -XX:+UnlockDiagnosticVMOptions -XX:StressSeed=829802955 -Xcomp -XX:+VerifyLoopOptimizations -XX:VerifyIterativeGVN=1110 -XX:MaxRAMPercentage=4.16667 -Dtest.boot.jdk=c:\ade\mesos\work_dir\jib-master\install\jdk\24\36\bundles\windows-x64\jdk-24_windows-x64_bin.zip\jdk-24 -Djava.io.tmpdir=c:\sb\prod\1749828829\testoutput\test-support\jtreg_closed_test_hotspot_jtreg_applications_javafuzzer_MediumTest_java\tmp -XX:+CreateCoredumpOnCrash Test
..............
C2:696    9    b        Test::lMeth (255 bytes)

Stack: [0x000000fc13700000,0x000000fc13800000],  sp=0x000000fc137fb4f0,  free space=1005k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [jvm.dll+0xe3396c]  PhaseIterGVN::verify_optimize+0x65c  (phaseX.cpp:1105)
V  [jvm.dll+0xe2dbf6]  PhaseIterGVN::optimize+0x446  (phaseX.cpp:1070)
V  [jvm.dll+0x5c83fa]  Compile::process_for_post_loop_opts_igvn+0x12a  (compile.cpp:1893)
V  [jvm.dll+0x5b8909]  Compile::Optimize+0xcf9  (compile.cpp:2521)
V  [jvm.dll+0x5b553a]  Compile::Compile+0x10fa  (compile.cpp:869)
V  [jvm.dll+0x4b9819]  C2Compiler::compile_method+0x179  (c2compiler.cpp:144)
V  [jvm.dll+0x5d39ae]  CompileBroker::invoke_compiler_on_method+0x7ae  (compileBroker.cpp:2323)
V  [jvm.dll+0x5d0cff]  CompileBroker::compiler_thread_loop+0x32f  (compileBroker.cpp:1968)
V  [jvm.dll+0x925268]  JavaThread::thread_main_inner+0x288  (javaThread.cpp:774)
V  [jvm.dll+0x1031532]  Thread::call_run+0x1b2  (thread.cpp:248)
V  [jvm.dll+0xde34f1]  thread_native_entry+0xe1  (os_windows.cpp:562)
C  [ucrtbase.dll+0x2268a]  (no source info available)
C  [KERNEL32.DLL+0x17ac4]  (no source info available)
C  [ntdll.dll+0x5a8c1]  (no source info available)
Comments
Changeset: 62a58062 Branch: master Author: BenoƮt Maillard <bmaillard@openjdk.org> Committer: Tobias Hartmann <thartmann@openjdk.org> Date: 2025-07-21 07:37:31 +0000 URL: https://git.openjdk.org/jdk/commit/62a58062e5f3d0a723608d98d2412ea779f73897
21-07-2025

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk/pull/26347 Date: 2025-07-16 12:42:32 +0000
16-07-2025

Since this is a missed optimization opportunity only, I suggest using known bit in TypeInt to free us from all these shenanigans.
15-07-2025

ILW = Missed IGVN optimization opportunity, single fuzzer test, use -XX:VerifyIterativeGVN=0 = MLM = P4
09-07-2025