-
Notifications
You must be signed in to change notification settings - Fork 5.8k
8319372: C2 compilation fails with "Bad immediate dominator info" #16844
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 roland! A progress list of the required criteria for merging this PR into |
Webrevs
|
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.
Agree.
@rwestrel 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 73 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 |
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 found myself before at that point to just get rid of this code to fix JDK-8272562 back there (also see #5199 (review)). It's a trade-off between better type information and avoiding these kind of issues. However, we could fix some cases by restricting try_sink_out_of_loop()
. However, there was still this test
$ java -Xcomp -XX:CompileOnly=Reduced*::* -XX:-TieredCompilation Reduced2.java
which fails with mainline today but would work with your fix. You might want to add this test case as well.
Maybe we need to step through all the reported test cases which we closed as duplicates of JDK-8275202 at some point and see if this patch can fix them as well. I have the feeling that it can.
Additionally, we might want to investigate separately at some point if this patch allows us to relax some of the constraints of try_sink_out_of_loop()
which we added fix these kind of issues with CastII
nodes. I'm not sure though how much benefit it will bring.
Anyway, the fix looks good to me!
* @run main/othervm -Xcomp -XX:CompileOnly=TestTopCastIIOnUndetectedDeadPath::test -XX:CompileCommand=quiet -XX:-TieredCompilation | ||
* -XX:+UnlockDiagnosticVMOptions -XX:StressSeed=426264791 -XX:+StressIGVN TestTopCastIIOnUndetectedDeadPath | ||
* @run main/othervm -Xcomp -XX:CompileOnly=TestTopCastIIOnUndetectedDeadPath::test -XX:CompileCommand=quiet -XX:-TieredCompilation | ||
* -XX:+UnlockDiagnosticVMOptions -XX:+StressIGVN TestTopCastIIOnUndetectedDeadPath |
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.
Since StressIGVN
is a C2 flag, you should also add a @requires vm.compiler2.enabled
. Same for the other test.
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.
Done in new commit.
I looked at this one and it indeed looks like some variation of the same problem (range checks are eliminated by range check elimination and not predication). I added it.
Yes, that would make sense.
This too makes sense to me.
Thanks for the review! |
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 is good.
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 too.
Nice, thanks!
Sounds good. I think I will do that and also file a new bug to re-link all of the duplicates of JDK-8275202 to it. Then we could revert it back to an RFE which I think it should be if you agree (it was just a nice side effect that it also fixed the linked bugs).
I will file an additional RFE while at it.
The update looks good! |
Sounds good to me. Thanks. Roland. |
@vnkozlov @chhagedorn @TobiHartmann thanks for the reviews. |
/integrate |
Going to push as commit 7766785.
Your commit was automatically rebased without conflicts. |
I filed JDK-8321097 as an umbrella bug and re-linked all the bugs from JDK-8275202 and turned it back into an RFE. I've walked through all the linked bugs and as suspected, the patch of this PR fixes the remaining (known) failing cases. I therefore closed JDK-8321097 again as "Not an Issue" (anymore). I found three additional test cases that were still failing but are now fixed with this patch. I'm planning to add them as separate test cases with JDK-8321107.
Filed JDK-8321109 to keep track of that. |
I included the test case from 8318690 because the cause of the failure
is similar, the fix I propose applies to both. If this fix goes in
then 8318690 can be closed as duplicate of this one.
In both cases, a
CastII
's type is narrowed because it is controldependent on a condition that tests the input of the
CastII
(code inCastIINode::Value()
). In both cases, thatCastII
is input to arange check
CastII
. Predication leaves that secondCastII
in theloop body but the range check that guards it is replaced by
predicates. The difference in the 2 test cases is where the first
CastII
comes from:PhiNode::Ideal()
in one case,PhaseIdealLoop::try_sink_out_of_loop()
in the other. The narrowedtype of the first
CastII
conflicts with the type of the range checkCastII
and that causes that one to become top. The path where thatCastII
is is unreachable but c2 can't prove it. The inconsistencycauses the asserts.
To fix this we would need to prove that the path where the
CastII
nodes are is dead and for that we would need to prove that the
condition that guards that path and at least one of the predicates
can't be true at the same time. While it may be feasible, that seems
like a lot of extra complexity.
Instead I propose removing the logic in
CastIINode::Value()
entirely. I went back to the change that introduced it and, as I
understand, it was added as an attempt to detect and remove useless
CastII
nodes. There was no correctness issue involved AFAICT.Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/16844/head:pull/16844
$ git checkout pull/16844
Update a local copy of the PR:
$ git checkout pull/16844
$ git pull https://git.openjdk.org/jdk.git pull/16844/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 16844
View PR using the GUI difftool:
$ git pr show -t 16844
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/16844.diff
Webrev
Link to Webrev Comment