C2: assert "bad if #1" in MultiNode::proj_out with StressLongCountedLoop

XMLWordPrintable

      Found while investigating https://bugs.openjdk.org/browse/JDK-8370948, repro file is the same, root causes could be related.

      crash:
      java -Xbatch -XX:-TieredCompilation -XX:StressLongCountedLoop=1 -XX:CompileCommand=compileonly,Test.test Test.java

      malformed control flow:
      java -Xbatch -XX:-TieredCompilation -XX:CompileCommand=compileonly,Test.test '-XX:CompileCommand=printcompilation,*,*' Test.java

      3960 102 b Test::test (62 bytes)
      3966 102 b Test::test (62 bytes) COMPILE SKIPPED: malformed control flow (retry at different tier)

      ---

      #
      # A fatal error has been detected by the Java Runtime Environment:
      #
      # Internal Error (/jdk/src/hotspot/share/opto/multnode.cpp:104), pid=800944, tid=800957
      # assert((Opcode() != Op_If && Opcode() != Op_RangeCheck) || outcnt() == 2) failed: bad if #1
      #
      # JRE version: OpenJDK Runtime Environment (27.0) (fastdebug build 27-internal-adhoc.katkerem.jdk)
      # Java VM: OpenJDK 64-Bit Server VM (fastdebug 27-internal-adhoc.katkerem.jdk, mixed mode, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
      ...
      V [libjvm.so+0x17960b2] MultiNode::proj_out(unsigned int) const+0x92 (multnode.cpp:104)
      V [libjvm.so+0x160979e] PhaseIdealLoop::is_counted_loop(Node*, IdealLoopTree*&, BasicType)+0xeee (loopnode.cpp:2502)
      V [libjvm.so+0x160b750] IdealLoopTree::counted_loop(PhaseIdealLoop*)+0x40 (loopnode.cpp:4557)
      V [libjvm.so+0x160b7c2] IdealLoopTree::counted_loop(PhaseIdealLoop*)+0xb2 (loopnode.cpp:4585)
      V [libjvm.so+0x1610bc2] PhaseIdealLoop::build_and_optimize()+0xaa2 (loopnode.cpp:5151)
      V [libjvm.so+0xc0e08f] PhaseIdealLoop::optimize(PhaseIterGVN&, LoopOptsMode)+0x4ff (loopnode.hpp:1224)
      V [libjvm.so+0xc07d4d] Compile::Optimize()+0xb0d (compile.cpp:2499)
      V [libjvm.so+0xc0b093] Compile::Compile(ciEnv*, ciMethod*, int, Options, DirectiveSet*)+0x2003 (compile.cpp:862)
      V [libjvm.so+0xa31131] C2Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)+0x471 (c2compiler.cpp:147)
      V [libjvm.so+0xc1aff3] CompileBroker::invoke_compiler_on_method(CompileTask*)+0xd73 (compileBroker.cpp:2345)
      V [libjvm.so+0xc1c140] CompileBroker::compiler_thread_loop()+0x520 (compileBroker.cpp:1989)
      V [libjvm.so+0x1187b26] JavaThread::thread_main_inner()+0x226 (javaThread.cpp:772)
      V [libjvm.so+0x1dcf66a] Thread::call_run()+0xba (thread.cpp:243)
      V [libjvm.so+0x185e298] thread_native_entry(Thread*)+0x118 (os_linux.cpp:929)
      C [libc.so.6+0x9caa4]

        1. Test.java
          0.7 kB
        2. TestMin.java
          0.5 kB

            Assignee:
            Kerem Kat
            Reporter:
            Kerem Kat
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: