-
Notifications
You must be signed in to change notification settings - Fork 6.2k
8280696: C2 compilation hits assert(is_dominator(c, n_ctrl)) failed #8770
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 thartmann! A progress list of the required criteria for merging this PR into |
|
@TobiHartmann The following label 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 list. If you would like to change these labels, use the /label pull request command. |
Webrevs
|
|
The question is why we have separate similar |
vnkozlov
left a comment
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.
I am fine with adding the check for Base`s control. But I would like to have additional investigation why we have similar Phi nodes for Base and Address. And also your suggestion about CastPP. Both in other RFEs.
|
@TobiHartmann 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 23 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 |
|
Thanks for the review, Vladimir!
That happens here: jdk/src/hotspot/share/opto/cfgnode.cpp Lines 2198 to 2219 in aa7ccdf
|
|
That code was introduced by JDK-8231291. Maybe @rwestrel can comment on why it's necessary to create individual Phis for base and address. |
Bug!!!: |
|
Oh, good catch! I fixed that as well (the original issue still reproduces but requires a different seed). |
chhagedorn
left a comment
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 good catch by Vladimir! Looks good to me, too.
rwestrel
left a comment
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.
Looks good to me.
|
Christian, Roland, thanks for the reviews! As Vladimir requested, I filed a follow-up RFE (JDK-8287009) for the useless CastPPs. I think the code creating two Phis for the Base and Address inputs is fine because they can be different but I leave it to @rwestrel to comment on that. |
vnkozlov
left a comment
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.
Update looks good.
|
Thanks, Vladimir! |
|
/integrate |
|
Going to push as commit fa1b56e.
Your commit was automatically rebased without conflicts. |
|
@TobiHartmann Pushed as commit fa1b56e. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
We hit an assert when computing early control via

PhaseIdealLoop::compute_early_ctrlfor1726 AddPbecause one of its control inputs1478 Regiondoes not dominate current control1350 Loopof the AddP:I.e., current control of the AddP is incorrect. The problem is that the code in
PhaseIdealLoop::has_local_phi_inputthat special cases AddP's only checks control of the Address (and Offset) input, assuming that control of the Base input is consistent.jdk/src/hotspot/share/opto/loopopts.cpp
Lines 333 to 337 in aa7ccdf
This is not guaranteed though, leading to the AddP ending up with control that is not dominated by control of its base input.
As described below, this only reproduces with a very specific sequence of optimizations triggered by replay compilation with
-XX:+StressIGVNand a fixed seed. I was not able to extract a regression test.The fix is to also check control of the Base input when moving the AddP up to a dominating point. For testing purposes, I added an
assert(get_ctrl(m->in(1)) != n_ctrl, "sanity")without the fix to verify that this change does not affect common cases. It triggers in the failing case but not for any test in tier 1 - 5. In addition, I slightly refactored the code ofPhaseIdealLoop::compute_early_ctrland added comments.Gory details below.
Relevant graph after parsing:
1724 Phiis then processed by the following code inPhiNode::Idealthat replaces its inputs by a cast of the unique input1730 CastPP:jdk/src/hotspot/share/opto/cfgnode.cpp
Lines 2013 to 2016 in aa7ccdf
Then
1724 Phiis replaced by the unique input1730 CastPP:Now
1459 CastPPis replaced by identical197 CastPP:Finally,
1725 Phiis replaced by unique input197 CastPPand the AddP ends up with two casts with different control of the same oop for Base and Address:Looking at the above transformation, the root cause is really the
1730 CastPPadded byPhiNode::Idealwhich is not needed and prevents the two casts from being merged. Is it worth filing a follow-up enhancement to fix this?Thanks,
Tobias
Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/8770/head:pull/8770$ git checkout pull/8770Update a local copy of the PR:
$ git checkout pull/8770$ git pull https://git.openjdk.java.net/jdk pull/8770/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 8770View PR using the GUI difftool:
$ git pr show -t 8770Using diff file
Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/8770.diff