C2: performance regression due to missing constant folding for Math.pow()

XMLWordPrintable

      Math.pow() doesn't constant folds when inputs are constant. For example, Math.pow(2, 1) should be replaced by `2`. This is not happening.

      It was observed starting with JDK11. JDK 8 is approximately 20 times faster with constant base and exponent. This is likely a performance regression with JDK-8145688.

      Additionally, strength reduction with Math.pow(x, 2.0D) => x*x introduced with JDK-8190869 does not work if the exponent only become a constant later during igvn. This should also be adressed.

      This issue was noticed and reported by one of our customers.

            Assignee:
            Kangcheng Xu
            Reporter:
            Kangcheng Xu
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: