When run with -XX:+UseAtomicValueFlattening, test compiler/valhalla/inlinetypes/TestBufferTearingC1.java crashes with the following message:
# Internal Error (/valhalla/open/src/hotspot/share/opto/loopnode.cpp:5885), pid=2227476, tid=2227502
# assert(!in->is_CFG()) failed: CFG Node with no controlling input?
#
# JRE version: Java(TM) SE Runtime Environment (25.0) (fastdebug build 25-lworld5ea-LTS-2025-03-28-1144114.fred...)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 25-lworld5ea-LTS-2025-03-28-1144114.fred..., mixed mode, tiered, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
# Problematic frame:
# V [libjvm.so+0x145d922] PhaseIdealLoop::build_loop_early(VectorSet&, Node_List&, Node_Stack&)+0x782
#
Stack trace:
Current thread (0x000079b6481362e0): JavaThread "C2 CompilerThread1" daemon [_thread_in_native, id=2227502, stack(0x000079b676630000,0x000079b676730000) (1024K)]
Current CompileTask:
C2:732 351 4 compiler.valhalla.inlinetypes.TestBufferTearingC1::writeRefs (83 bytes)
Stack: [0x000079b676630000,0x000079b676730000], sp=0x000079b67672ae10, free space=1003k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V [libjvm.so+0x145d922] PhaseIdealLoop::build_loop_early(VectorSet&, Node_List&, Node_Stack&)+0x782 (loopnode.cpp:5885)
V [libjvm.so+0x146b12c] PhaseIdealLoop::build_and_optimize()+0x6bc (loopnode.cpp:4777)
V [libjvm.so+0xad001d] PhaseIdealLoop::optimize(PhaseIterGVN&, LoopOptsMode)+0x41d (loopnode.hpp:1158)
V [libjvm.so+0xac9cdc] Compile::Optimize()+0x67c (compile.cpp:2849)
V [libjvm.so+0xacd28b] Compile::Compile(ciEnv*, ciMethod*, int, Options, DirectiveSet*)+0x1f2b (compile.cpp:866)
V [libjvm.so+0x8f75ad] C2Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)+0x46d (c2compiler.cpp:142)
V [libjvm.so+0xadab8c] CompileBroker::invoke_compiler_on_method(CompileTask*)+0xbfc (compileBroker.cpp:2331)
V [libjvm.so+0xadbac8] CompileBroker::compiler_thread_loop()+0x598 (compileBroker.cpp:1975)
V [libjvm.so+0x101c47f] JavaThread::thread_main_inner()+0x12f (javaThread.cpp:777)
V [libjvm.so+0x1a28e46] Thread::call_run()+0xb6 (thread.cpp:231)
V [libjvm.so+0x16b8378] thread_native_entry(Thread*)+0x128 (os_linux.cpp:877)
C [libc.so.6+0x9caa4]
# Internal Error (/valhalla/open/src/hotspot/share/opto/loopnode.cpp:5885), pid=2227476, tid=2227502
# assert(!in->is_CFG()) failed: CFG Node with no controlling input?
#
# JRE version: Java(TM) SE Runtime Environment (25.0) (fastdebug build 25-lworld5ea-LTS-2025-03-28-1144114.fred...)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 25-lworld5ea-LTS-2025-03-28-1144114.fred..., mixed mode, tiered, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
# Problematic frame:
# V [libjvm.so+0x145d922] PhaseIdealLoop::build_loop_early(VectorSet&, Node_List&, Node_Stack&)+0x782
#
Stack trace:
Current thread (0x000079b6481362e0): JavaThread "C2 CompilerThread1" daemon [_thread_in_native, id=2227502, stack(0x000079b676630000,0x000079b676730000) (1024K)]
Current CompileTask:
C2:732 351 4 compiler.valhalla.inlinetypes.TestBufferTearingC1::writeRefs (83 bytes)
Stack: [0x000079b676630000,0x000079b676730000], sp=0x000079b67672ae10, free space=1003k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V [libjvm.so+0x145d922] PhaseIdealLoop::build_loop_early(VectorSet&, Node_List&, Node_Stack&)+0x782 (loopnode.cpp:5885)
V [libjvm.so+0x146b12c] PhaseIdealLoop::build_and_optimize()+0x6bc (loopnode.cpp:4777)
V [libjvm.so+0xad001d] PhaseIdealLoop::optimize(PhaseIterGVN&, LoopOptsMode)+0x41d (loopnode.hpp:1158)
V [libjvm.so+0xac9cdc] Compile::Optimize()+0x67c (compile.cpp:2849)
V [libjvm.so+0xacd28b] Compile::Compile(ciEnv*, ciMethod*, int, Options, DirectiveSet*)+0x1f2b (compile.cpp:866)
V [libjvm.so+0x8f75ad] C2Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)+0x46d (c2compiler.cpp:142)
V [libjvm.so+0xadab8c] CompileBroker::invoke_compiler_on_method(CompileTask*)+0xbfc (compileBroker.cpp:2331)
V [libjvm.so+0xadbac8] CompileBroker::compiler_thread_loop()+0x598 (compileBroker.cpp:1975)
V [libjvm.so+0x101c47f] JavaThread::thread_main_inner()+0x12f (javaThread.cpp:777)
V [libjvm.so+0x1a28e46] Thread::call_run()+0xb6 (thread.cpp:231)
V [libjvm.so+0x16b8378] thread_native_entry(Thread*)+0x128 (os_linux.cpp:877)
C [libc.so.6+0x9caa4]