Reassociate loop invariants involved in Cmps and Add/Subs

XMLWordPrintable

    • Type: Enhancement
    • Resolution: Fixed
    • Priority: P5
    • 23
    • Affects Version/s: 23
    • Component/s: hotspot
    • b19
    • generic
    • generic

      Following the ideas of https://bugs.openjdk.org/browse/JDK-8250808, we can reassociate expressions involving Cmps and Add/Subs

      ```
      // Apply the same transformations to == and !=
      inv1 == (x + inv2) => ( inv1 - inv2 ) == x
      inv1 == (x - inv2) => ( inv1 + inv2 ) == x
      inv1 == (inv2 - x) => (-inv1 + inv2 ) == x
      ```

      This can only be done for `==` and `!=`, or else we can break comparisons if there are overflows.

            Assignee:
            Joshua Cao
            Reporter:
            Joshua Cao
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: