8371674: C2 fails with Missed optimization opportunity in PhaseIterGVN for MoveL2D #28290
+64
−2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR addresses yet another missed optimization in
PhaseIterGVN. The way this optimization is triggered is a bit different this time though, and the notification is missing inNode::has_special_unique_user.Analysis
The affected optimization is the transformation of
MoveX2Y (LoadX mem)intoLoadY mem. This is implemented inMoveNode::Ideal. The optimization is as follows:The optimization is triggered only if the input is a
LoadNodeand theMoveNodeis its only user. This is a relatively unusual pattern.The bug was found by the fuzzer. At some point during IGVN, we have the following subgraph:
In
RegionNode::Ideal, we end up callingset_req_Xon thePhinode to delete the edge from thePhinode toLoadL. As a result, theLoadLnode only has one user left, and theMoveNode::Idealgets triggered at the next verification pass.Proposed Solution
Add this particular case to
Node::has_special_unique_user, which gets called byNode::set_req_X.Summary of changes
This PR brings the following changes:
Node::has_special_unique_user.TestMissingOptMoveX2YLoadX.java, initially obtained from the fuzzer and then heavily reduced, both with the usual tools and manually. I tried to get a reproducer for each of theMovenodes, but I was only able to get one forMoveL2D.Testing
Thank you for reviewing!
Progress
Issue
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/28290/head:pull/28290$ git checkout pull/28290Update a local copy of the PR:
$ git checkout pull/28290$ git pull https://git.openjdk.org/jdk.git pull/28290/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 28290View PR using the GUI difftool:
$ git pr show -t 28290Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/28290.diff
Using Webrev
Link to Webrev Comment