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

C2: Reuse cmp condition codes in adjacent basic blocks

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • 16
    • hotspot

      In the attached program Foo.java, The C2-generated x86_64 code performs the test cmpl RSI, #1 twice in adjacent blocks. The second cmpl is redundant and could be just removed.

      $ java -Xcomp -XX:-TieredCompilation -XX:CompileOnly=Foo::foo -XX:+PrintOptoAssembly -XX:LoopUnrollLimit=0 Foo.java
      (..)
      033 cmpl RSI, #1
      036 je,s B5 P=0,200000 C=1,000000

      038 B2: # out( B5 B3 ) <- in( B1 ) Freq: 0,8
      038 cmpl RSI, #1
      (..)

      The assembly-level CFG is attached for clarity.

        1. cfg.pdf
          32 kB
        2. Foo.java
          0.3 kB

            Unassigned Unassigned
            rcastanedalo Roberto Castaneda Lozano
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: