Skip to content

8373731: C2: Missed optimization opportunity for AddI#29713

Open
hgqxjj wants to merge 5 commits intoopenjdk:masterfrom
hgqxjj:8373731
Open

8373731: C2: Missed optimization opportunity for AddI#29713
hgqxjj wants to merge 5 commits intoopenjdk:masterfrom
hgqxjj:8373731

Conversation

@hgqxjj
Copy link
Member

@hgqxjj hgqxjj commented Feb 13, 2026

Please review this change. Thanks!

This change fixes a missed optimization in C2 IGVN where Add/Sub cancellation patterns such as x + (y - x) and (x - y) + y are not eliminated after an upstream rewrite exposes the cancellation opportunity. The root cause is that input edge rewiring on a SubI/SubL does not reliably re-enqueue its AddI/AddL users.

To address this, the change enqueues the relevant AddI/AddL users when the corresponding SubI/SubL node is processed in PhaseIterGVN::subsume_node(), where the graph has already been rewired. Only Add users matching the cancellation shape are enqueued to keep the worklist impact minimal.

Test: GHA


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8373731: C2: Missed optimization opportunity for AddI (Enhancement - P4)

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/29713/head:pull/29713
$ git checkout pull/29713

Update a local copy of the PR:
$ git checkout pull/29713
$ git pull https://git.openjdk.org/jdk.git pull/29713/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 29713

View PR using the GUI difftool:
$ git pr show -t 29713

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/29713.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Feb 13, 2026

👋 Welcome back ghan! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Feb 13, 2026

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

@openjdk openjdk bot added the hotspot-compiler hotspot-compiler-dev@openjdk.org label Feb 13, 2026
@openjdk
Copy link

openjdk bot commented Feb 13, 2026

@hgqxjj The following label will be automatically applied to this pull request:

  • hotspot-compiler

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the rfr Pull request is ready for review label Feb 13, 2026
@mlbridge
Copy link

mlbridge bot commented Feb 13, 2026

Webrevs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hotspot-compiler hotspot-compiler-dev@openjdk.org rfr Pull request is ready for review

Development

Successfully merging this pull request may close these issues.

1 participant