Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8287284

C2: loop optimization performs split_thru_phi infinitely many times

    XMLWordPrintable

Details

    • b24

    Description

      Compile::optimize_loops performs always the same optimization until it reaches the `LoopOptsCount` limit. `Major progress` is set in `PhaseIdealLoop::split_if_with_blocks` -> `PhaseIdealLoop::split_if_with_blocks_pre` after performing `PhaseIdealLoop::split_thru_phi`. This creates a chain of `phis` in the graph without any benefit for performance. Without the limit of `LoopOptsCount` this would run infinitely many times.

      HOW TO REPRODUCE

      Run the following command on a debug JDK build:

      $ java -Xbatch -XX:-PartialPeelLoop -XX:CompileCommand=compileonly,Test::run Test.java

      # A fatal error has been detected by the Java Runtime Environment:
      #
      # Internal Error (src/hotspot/share/opto/compile.cpp:2065), pid=7080, tid=7093
      # assert(cnt++ < 40) failed: infinite cycle in loop optimization
      #
      # JRE version: Java(TM) SE Runtime Environment (19.0+23) (fastdebug build 19-ea+23-1706)
      # Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 19-ea+23-1706, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
      # Problematic frame:
      # V [libjvm.so+0xaba94c] Compile::Optimize()+0x180c

      Attachments

        1. Reproducer.java
          0.5 kB
        2. Test.java
          0.5 kB

        Issue Links

          Activity

            People

              tholenstein Tobias Holenstein
              tholenstein Tobias Holenstein
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: