JDK-8318690 : C2: assert(!had_error) failed: bad dominance
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 17.0.2,21,22
  • Priority: P3
  • Status: Open
  • Resolution: Unresolved
  • Submitted: 2023-10-23
  • Updated: 2023-11-09
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
22Unresolved
Related Reports
Relates :  
Relates :  
Description
Bad graph detected in compute_lca_of_uses
n:  591  LShiftL  === _ 688 138  [[ 587 682 ]]  !orig=[199],139 !jvms: Test::test @ bci:16 (line 8)
early(n):  450  IfTrue  === 449  [[ 208 201 ]] #1 !orig=209,149 !jvms: Test::test @ bci:21 (line 9)
n->in(1):  688  ConvI2L  === _ 201  [[ 591 ]]  #long:0..maxint-1:www !orig=[681],[668]
early(n->in(1)):  450  IfTrue  === 449  [[ 208 201 ]] #1 !orig=209,149 !jvms: Test::test @ bci:21 (line 9)
n->in(1)->in(1):  201  CastII  === 450 528  [[ 688 ]]  #int:0..max-1:www range check dependency !orig=136 !jvms: Test::test @ bci:16 (line 8)
early(n->in(1)->in(1)):  450  IfTrue  === 449  [[ 208 201 ]] #1 !orig=209,149 !jvms: Test::test @ bci:21 (line 9)
n->in(2):  138  ConI  === 0  [[ 591 254 300 442 527 ]]  #int:2
early(n->in(2)):    0  Root  === 0 618 67 78 167 134 156 608 384 400  [[ 0 1 3 20 21 163 162 29 46 476 62 73 88 96 97 102 104 473 119 129 138 143 151 342 488 512 514 553 562 563 566 571 596 620 672 676 686 689 694 ]] 

LCA(n):  649  IfTrue  === 648  [[ 639 ]] #1 !orig=450,209,149 !jvms: Test::test @ bci:21 (line 9)
n->out(0):  587  AddP  === _ 118 118 591  [[ 584 ]]  !orig=[196],141 !jvms: Test::test @ bci:16 (line 8)
later(n->out(0)):  655  IfFalse  === 236  [[ 243 486 242 ]] #0 !orig=[546],[463],[237],[216],[93] !jvms: Test::test @ bci:7 (line 6)
n->out(0)->out(0):  584  AddP  === _ 118 587 20  [[ 486 ]]  !orig=[189],140 !jvms: Test::test @ bci:16 (line 8)
later(n->out(0)->out(0)):  655  IfFalse  === 236  [[ 243 486 242 ]] #0 !orig=[546],[463],[237],[216],[93] !jvms: Test::test @ bci:7 (line 6)
n->out(1):  682  Phi  === 542 527 591  [[ 683 ]]  #long:0..8589934584:www
later(n->out(1)):  542  Region  === 542 660 651  [[ 542 487 459 682 ]]  !orig=[460],[321],[275],[220],[150] !jvms: Test::test @ bci:21 (line 9)
n->out(1)->out(0):  683  AddP  === _ 118 118 682  [[ 675 ]]  !orig=[674]
later(n->out(1)->out(0)):  542  Region  === 542 660 651  [[ 542 487 459 682 ]]  !orig=[460],[321],[275],[220],[150] !jvms: Test::test @ bci:21 (line 9)

idoms of early "450 IfTrue":
idom[7]:   649  IfTrue
idom[6]:   639  If
idom[5]:   640  IfTrue
idom[4]:   530  If
idom[3]:   533  IfTrue
idom[2]:   534  If
idom[1]:   535  IfTrue
idom[0]:   449  If
n:         450  IfTrue

idoms of (wrong) LCA "649 IfTrue":
n:         649  IfTrue

Real LCA of early "450 IfTrue" (idom[7]) and wrong LCA "649 IfTrue":
 649  IfTrue  === 648  [[ 639 ]] #1 !orig=450,209,149 !jvms: Test::test @ bci:21 (line 9)

*** Use 651 isn't dominated by def 591 ***
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (/opt/mach5/mesos/work_dir/slaves/afbc6042-3a24-4198-9369-18c663a3f74c-S26242/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/0cfb922c-210b-4e07-82e4-ef143301c4ad/runs/3e746376-e656-4570-bcfa-3a47e4fb6164/workspace/open/src/hotspot/share/opto/loopnode.cpp:5665), pid=2883101, tid=2883115
#  assert(!had_error) failed: bad dominance
#
# JRE version: Java(TM) SE Runtime Environment (22.0+21) (fastdebug build 22-ea+21-1641)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 22-ea+21-1641, mixed mode, sharing, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
# Problematic frame:
# V  [libjvm.so+0x12a9b04]  PhaseIdealLoop::compute_lca_of_uses(Node*, Node*, bool)+0x914

Current CompileTask:
C2:1716   81 % !b        Test::test @ 4 (35 bytes)

Stack: [0x00007f0c05eff000,0x00007f0c06000000],  sp=0x00007f0c05ffab90,  free space=1006k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0x12a9b04]  PhaseIdealLoop::compute_lca_of_uses(Node*, Node*, bool)+0x914  (loopnode.cpp:5665)
V  [libjvm.so+0x12a9dee]  PhaseIdealLoop::build_loop_late_post_work(Node*, bool)+0x16e
V  [libjvm.so+0x12aa75d]  PhaseIdealLoop::build_loop_late(VectorSet&, Node_List&, Node_Stack&)+0xbd
V  [libjvm.so+0x12ab08d]  PhaseIdealLoop::build_and_optimize()+0x61d
V  [libjvm.so+0x9fd975]  PhaseIdealLoop::verify(PhaseIterGVN&)+0x425
V  [libjvm.so+0x9f2d7f]  Compile::process_for_post_loop_opts_igvn(PhaseIterGVN&)+0x1f
V  [libjvm.so+0x9fa1dd]  Compile::Optimize()+0x101d
V  [libjvm.so+0x9fc681]  Compile::Compile(ciEnv*, ciMethod*, int, Options, DirectiveSet*)+0x1bc1
V  [libjvm.so+0x849ca7]  C2Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)+0x207
V  [libjvm.so+0xa08725]  CompileBroker::invoke_compiler_on_method(CompileTask*)+0x9f5
V  [libjvm.so+0xa09438]  CompileBroker::compiler_thread_loop()+0x508
V  [libjvm.so+0xec438c]  JavaThread::thread_main_inner()+0xcc
V  [libjvm.so+0x17a22ca]  Thread::call_run()+0xba
V  [libjvm.so+0x14a710a]  thread_native_entry(Thread*)+0x12a
Comments
[~roland] would you have time to take a look?
24-10-2023

ILW = C2 assertion failure, found with single Java Fuzzer test, use -XX:-SplitIfBlocks = HLM = P3
24-10-2023

Attached Test.java also reproduces the issue on Linux x64 and since JDK 17.0.2 and JDK 18, JDK-8316918 must be unrelated: java -XX:RepeatCompilation=100 -XX:CompileCommand=quiet -XX:CompileCommand=compileonly,Test::test -XX:-TieredCompilation -Xbatch -XX:+StressIGVN Test.java
24-10-2023

Only reproduced on Linux AArch64. I narrowed it down to JDK-8316918. Will now try to reduce the test.
24-10-2023

Reproduces since JDK-8272562 in JDK 18 b17.
24-10-2023