-
Notifications
You must be signed in to change notification settings - Fork 6.1k
8359121: C2: Region added by vectorizedMismatch intrinsic can survive as a dead node after IGVN #25749
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
👋 Welcome back mchevalier! A progress list of the required criteria for merging this PR into |
|
@marc-chevalier This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be: You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 6 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. ➡️ To integrate this PR with the above commit message to the |
|
@marc-chevalier The following labels will be automatically applied to this pull request:
When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing lists. If you would like to change these labels, use the /label pull request command. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice analysis Marc. I also prefer solution (1) and the fix looks good to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice analysis and summary! As you've already mentioned in the description, we found solution 1 to be the best fit.
|
/integrate Thanks both for review! |
|
Going to push as commit b6ec93b.
Your commit was automatically rebased without conflicts. |
|
@marc-chevalier Pushed as commit b6ec93b. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
In
bool LibraryCallKit::inline_vectorizedMismatch()the region created at:jdk/src/hotspot/share/opto/library_call.cpp
Line 6502 in 0582bd2
may have only one input, and be a copy (that is no self-loop) and a single input. It is thus safe to remove. Yet, in the reproducer case, the node is short-circuited, but stays in the graph after IGVN.
Left, after Parsing/before IGVN; right, after IGVN:

⚠️ is there because the Region doesn't have a self loop, which is expected for copies. On the right, it still doesn't have a self-loop, but IGV is also complaining the Region has no successor.
On the left, the
This transformation comes from
IfNode::Ideal, that callsIfNode::Ideal_common, that callsNode::remove_dead_region, that shortcuts a trivial Region input:jdk/src/hotspot/share/opto/node.cpp
Lines 1480 to 1484 in 0582bd2
Yet, the Region node is never enqueued for IGVN, so stays in the graph. This is not nice because it gives both:
While at the end of IGVN, we could expect the graph to be cleaned up. There are couple ways of doing, each being enough by itself:
LibraryCallKit::inline_vectorizedMismatch, and not hoping it would be collected by another consequenceNode::remove_dead_regionto useset_req_Xinstead ofset_req, so that if the Region goes dead, it will be removed.LibraryCallKit::inline_vectorizedMismatchif we are going to have only one path, and thus avoid the problem entirely.The solution 3. is really not easy and would require quite some code restructuring for simply saving removing a node. After discussing with @chhagedorn, we concluded that the solution 1. was probably the best:
inline_vectorizedMismatchcallrecord_for_igvnthemselves,remove_dead_region, it's not a general problem at all: I couldn't find another case without usinginline_vectorizedMismatchwhere the Region is put aside, and not entirely disconnected quickly after, but the Region is always processed in the same IGVN whenremove_dead_regionmakes it dead.And then, we find that:

This was found because it makes a check of JDK-8350864 to fail. My plan is to add this structural invariant check to the test once the flag is integrated, as for now, the test need manual inspection to see a difference. It's also not really possible to write an IR test with it: the Region node is not reachable by under (use to def traversal from Root), so the printout of the graph doesn't show the Region node, even if the
50 Projabove is indeed printed to have 2 outputs, only the57 Ifis actually printed.Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/25749/head:pull/25749$ git checkout pull/25749Update a local copy of the PR:
$ git checkout pull/25749$ git pull https://git.openjdk.org/jdk.git pull/25749/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 25749View PR using the GUI difftool:
$ git pr show -t 25749Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/25749.diff
Using Webrev
Link to Webrev Comment