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

Reassociate loop invariants involved in Cmps and Add/Subs

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P5 P5
    • 23
    • 23
    • 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.

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

              Created:
              Updated:
              Resolved: