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
8280600: C2: assert(!had_error) failed: bad dominance #7307
Conversation
|
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.
Seems good. Will run testing before approval.
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.
Testing passed.
@rwestrel This change now passes all automated pre-integration checks. 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 52 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.
|
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 reasonable to me.
public static void main(String[] k) { | ||
TestCastIIMakesMainLoopPhiDead t = new TestCastIIMakesMainLoopPhiDead(); | ||
for (int i = 0; i < 3; i++) { | ||
t.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.
Indentation is inconsistent (4 whitespaces for Java code).
@vnkozlov thanks for review and testing |
/integrate |
Going to push as commit de826ba.
Your commit was automatically rebased without conflicts. |
For the inner loop of the test, c2, first, creates a counted loop and
assigns the type -400..1 to the trip count Phi. The loop body has a
range check that guards a CastII on the trip count Phi. That CastII
has type: 0..1 as a result.
Pre/main/post loops are then created. In the process,
PhaseIdealLoop::cast_incr_before_loop() inserts a CastII right before
the main loop. That CastII's input is the add node of the pre
loop. The loop is also unrolled once. The CastII on the loop entry is
pushed through the add node and replaced by the range check CastII
that has the same input and dominates. As a result, the main loop
tripcount Phi has type -400..1 but init value, 1..2. This causes the
Phi to constant fold to 1. The amount of unrolling and the main loop
bounds are inconsistent (the loop shouldn't be unrolled if it executes
for one iteration) but when the unrolling decision is made the type of
the lower bound of the main loop is not yet accurately known.
The actual crash is the result of a chain of nodes sunk out of the
inner loop and pinned out of the loop with a CastII node. The type of
the CastII and the type of its input after unrolling conflict.
The fix I propose is to change the type of the CastII that's added
before the main loop so it can't be replaced by a dominating
CastII. Given that CastII's role is to carry dependencies for nodes in
the loop body on the loop entry test, I think it's the right thing to
do. I've also been working on 8275202 (C2: optimize out more redundant
conditions) as a way to avoid type inconsistencies like this one.
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/7307/head:pull/7307
$ git checkout pull/7307
Update a local copy of the PR:
$ git checkout pull/7307
$ git pull https://git.openjdk.java.net/jdk pull/7307/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 7307
View PR using the GUI difftool:
$ git pr show -t 7307
Using diff file
Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/7307.diff