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

Reassociate binary operators for LongCountedLoops

XMLWordPrintable

    • generic
    • generic

      For example:

      ```
      for (long i = 0; i < n; ++i) { foo(a + i + b); }
      ```
      Can be reassociated to get
      ```
      for (long i = 0; i < n; ++i) { foo(a + b + i); }
      ```

      There is already reassociation code, but it is only applied to `CountedLoop`. `LongCountedLoop` is not a `CountedLoop` by inheritance. https://github.com/openjdk/jdk/blob/99c9ae127c0a3b8c4fc6ede87079ff7c693a2905/src/hotspot/share/opto/loopnode.cpp#L4772-L4777

      This might have been regressed in JDK-8259609
      The code is there already

            Unassigned Unassigned
            jcao Joshua Cao
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: