JDK-8318049 : C2: assert(!failure) failed: Missed optimization opportunity in PhaseIterGVN
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 17,21,22
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2023-10-12
  • Updated: 2024-05-23
  • Resolved: 2023-10-20
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 22
22 b21Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Description
java -XX:CompileCommand=quiet -XX:CompileCommand=compileonly,*Test*::* -XX:-TieredCompilation -Xcomp -XX:VerifyIterativeGVN=10 Test

Missed Value optimization:
dist dump
---------------------------------------------
   1  1118  CastII  === 1119 329  [[ 1117 ]]  #int unconditional dependency !orig=[1091],[1063],[1034],[872]
   1   329  ConvL2I  === _ 11  [[ 1118 925 1117 922 924 ]]  #int !orig=[971],[881],[834],[527],[600],[330],335 !jvms: Test::vMeth @ bci:85 (line 67)
   0  1117  XorI  === _ 329 1118  [[ 1121 ]]  !orig=[1090],[1062],[1033],[875],[853],[527],[600],[330],335 !jvms: Test::vMeth @ bci:86 (line 67)
Current type:
int
Optimized type:
int:0
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (/System/Volumes/Data/mesos/work_dir/slaves/cd627e65-f015-4fb1-a1d2-b6c9b8127f98-S180582/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/6a2a4984-4d83-4722-b042-c2993143272c/runs/686c04b7-8c90-4e39-b85e-83f44700225c/workspace/open/src/hotspot/share/opto/phaseX.cpp:1087), pid=25494, tid=42243
#  assert(!failure) failed: Missed optimization opportunity in PhaseIterGVN
#
# JRE version: Java(TM) SE Runtime Environment (22.0+19) (fastdebug build 22-ea+19-1462)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 22-ea+19-1462, compiled mode, sharing, compressed oops, compressed class ptrs, g1 gc, bsd-amd64)
# No core dump will be written. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /private/tmp/fuzzer.tmp.YapA5EsTyr/hs_err_pid25494.log
#
# Compiler replay data is saved as:
# /private/tmp/fuzzer.tmp.YapA5EsTyr/replay_pid25494.log
#
# If you would like to submit a bug report, please visit:
#   https://bugreport.java.com/bugreport/crash.jsp
#

Current CompileTask:
C2:552    5    b        Test::vMeth (255 bytes)

Stack: [0x000070000b703000,0x000070000b803000],  sp=0x000070000b7ff370,  free space=1008k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.dylib+0x12199b4]  VMError::report_and_die(int, char const*, char const*, __va_list_tag*, Thread*, unsigned char*, void*, void*, char const*, int, unsigned long)+0x5a4  (phaseX.cpp:1087)
V  [libjvm.dylib+0x121a148]  VMError::report_and_die(Thread*, void*, char const*, int, char const*, char const*, __va_list_tag*)+0x38
V  [libjvm.dylib+0x6564a4]  report_vm_error(char const*, int, char const*, char const*, ...)+0xb4
V  [libjvm.dylib+0xf4b2e0]  PhaseIterGVN::verify_optimize()+0x550
V  [libjvm.dylib+0xf4b6db]  PhaseIterGVN::optimize()+0x2bb
V  [libjvm.dylib+0x5ba528]  Compile::process_for_post_loop_opts_igvn(PhaseIterGVN&)+0x108
V  [libjvm.dylib+0x5b5985]  Compile::Optimize()+0xb65
V  [libjvm.dylib+0x5b35f3]  Compile::Compile(ciEnv*, ciMethod*, int, Options, DirectiveSet*)+0x1593
V  [libjvm.dylib+0x4777e6]  C2Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)+0x1a6
V  [libjvm.dylib+0x5d263f]  CompileBroker::invoke_compiler_on_method(CompileTask*)+0xa9f
V  [libjvm.dylib+0x5d1797]  CompileBroker::compiler_thread_loop()+0x357
V  [libjvm.dylib+0x9a9015]  JavaThread::thread_main_inner()+0x1a5
V  [libjvm.dylib+0x1160fcc]  Thread::call_run()+0xbc
V  [libjvm.dylib+0xeea9a2]  thread_native_entry(Thread*)+0x122
C  [libsystem_pthread.dylib+0x68fc]  _pthread_start+0xe0
C  [libsystem_pthread.dylib+0x2443]  thread_start+0xf
Lock stack of current Java thread (top to bottom):


This failure mode was previously addressed by:

JDK-8316361 C2: assert(!failure) failed: Missed optimization opportunity in PhaseIterGVN with -XX:VerifyIterativeGVN=10

which was integrated in jdk-22+18-1378. This failure
sighting occurred in jdk-22+19-1462-tier8.
Comments
Looks to me that Xor(I,L)Node::Value added eqv_uncast in JDK-8261008, so this issue nominally affects JDK 17 as well, even if it is not caught by verification, right? Linking up.
23-10-2023

Changeset: a03767cf Author: Jasmine Karthikeyan <jkarthikeyan@openjdk.org> Committer: Emanuel Peter <epeter@openjdk.org> Date: 2023-10-20 10:44:58 +0000 URL: https://git.openjdk.org/jdk/commit/a03767cf8868a200f5be74c4cf8cdf5f76f1e678
20-10-2023

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/16214 Date: 2023-10-17 09:52:28 +0000
17-10-2023

This seems to happen as the case of notifying users of constraint cast nodes in PhaseIterGVN::add_users_to_worklist only informs phi and sub users, but xor nodes also perform eqv_uncast in their Value calls, to see if the inputs are equivalent and return 0. By additionally checking "n->Opcode() == Op_XorI || n->Opcode() == Op_XorL" the assertion no longer trips.
16-10-2023

ILW = Same as JDK-8316361 = P4
16-10-2023