JDK-8283094 : Add Ideal transformation: x + (con - y) -> (x - y) + con
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 19
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • OS: generic
  • CPU: generic
  • Submitted: 2022-03-11
  • Updated: 2022-03-15
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbdUnresolved
Related Reports
Relates :  
Description
A DESCRIPTION OF THE PROBLEM :
`x + (con - y)  -> (x - y) + con` is a widely seen pattern; however it is missing in current implementation, which prevents some obvious constant folding from happening, such as `x + (1 - y) + 2` will be not optimized at all, rather than into `x - y + 3`.

A pull request has been created: https://github.com/openjdk/jdk/pull/7795



Comments
A pull request was submitted for review. URL: https://git.openjdk.java.net/jdk/pull/7795 Date: 2022-03-11 23:40:19 +0000
14-03-2022

Moving it to JDK for further analysis.
14-03-2022