C2: Missed Ideal() optimization opportunities in PhaseIterGVN with AddL and URShiftL

XMLWordPrintable

      This was initially thought to be the same issue as JDK-8373251, but it turns out it is a separate issue.

      The attached Java Fuzzer test fails due to missing optimization opportunities with AddL and URShiftL:

      java -XX:CompileCommand="compileonly,*Test2*::*" -XX:-TieredCompilation -Xbatch -XX:PerMethodTrapLimit=0 -XX:VerifyIterativeGVN=1110 Test2.java

      Missed Ideal optimization (can_reshape=false):
      The node was replaced by Ideal.
      Old node:
      dist dump
      ---------------------------------------------
         1 26 ConI === 0 [[ 329 467 84 ]] #int:1
         1 468 AddL === _ 84 84 [[ 467 ]] !orig=410,231 !jvms: Test2::lMeth1 @ bci:164 (line 46)
         0 467 URShiftL === _ 468 26 [[ 466 466 ]] !orig=409,236,[440] !jvms: Test2::lMeth1 @ bci:173 (line 47)
      The result after Ideal:
      dist dump
      ---------------------------------------------
         1 512 ConL === 0 [[ 513 515 ]] #long:maxlong
         1 514 AddL === _ 382 513 [[ 515 ]]
         0 515 AndL === _ 514 512 [[ ]]

      #
      # A fatal error has been detected by the Java Runtime Environment:
      #
      # Internal Error (/home/bmaillar/src/jdk/JDK-8371536/open/src/hotspot/share/opto/phaseX.cpp:1885), pid=2209995, tid=2210004
      # assert(false) failed: Missed Ideal optimization opportunity in PhaseIterGVN for URShiftL
      #
      # JRE version: Java(TM) SE Runtime Environment (27.0) (fastdebug build 27-internal-bmaillar.open)
      # Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 27-internal-bmaillar.open, mixed mode, compressed oops, compressed class ptrs, serial gc, linux-amd64)
      # Problematic frame:
      # V [libjvm.so+0x18a258c] PhaseIterGVN::verify_Ideal_for(Node*, bool)+0x65c
      #
      # Core dump will be written. Default location: Determined by the following: "/usr/lib/systemd/systemd-coredump %P %u %g %s %t %c %h %d" (alternatively, falling back to /home/bmaillar/src/jdk/JDK-8373251/core.2209995)
      #
      # An error report file with more information is saved as:
      # /home/bmaillar/src/jdk/JDK-8373251/hs_err_pid2209995.log
      #
      # Compiler replay data is saved as:
      # /home/bmaillar/src/jdk/JDK-8373251/replay_pid2209995.log
      #
      # If you would like to submit a bug report, please visit:
      # https://bugreport.java.com/bugreport/crash.jsp
      #

        1. Reduced.java
          0.2 kB
        2. Test2.java
          10 kB

            Assignee:
            Benoît Maillard
            Reporter:
            Benoît Maillard
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: