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

New C2 peephole doesn't activate in all cases

XMLWordPrintable

    • generic
    • generic

      A DESCRIPTION OF THE PROBLEM :
      Following JDK-8283699, optimizations were added to make peephole transforms to combine moves and left shifts into a single "lea" instruction. However, as described in the RFR, this optimization seems to only work in the case that the mov instruction comes before the shift instruction, and not in the case that the mov comes after the shift. For example, in this case:
      public int shift(int x) {
        return x << 1 >> 2;
      }
      the following opto assembly is created:
      01a sall RDX, #1
      01c movl RAX, RDX # spill
      01e sarl RAX, #2

      The sal and the mov could be combined into a "lea RAX, [RDX << #1]" similarly to what a method with just the body "return x << 1;" would create.


            Unassigned Unassigned
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: