-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
8307927: C2: "malformed control flow" with irreducible loop #14522
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.
Looks reasonable to me. All tests passed.
@eme64 Please have a look as well.
@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 87 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 |
@@ -3514,9 +3514,9 @@ bool IdealLoopTree::beautify_loops( PhaseIdealLoop *phase ) { | |||
// encountered. Helper for check_safepts. | |||
void IdealLoopTree::allpaths_check_safepts(VectorSet &visited, Node_List &stack) { |
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.
@rwestrel you should update the description here. Suggestion:
Allpaths backwards scan. Starting at the head, traversing all backedges, and the body. Terminating each path at first safepoint encountered. Helper for check_safepts.
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.
Also the line above is not accurate enough anymore:
_required_safept->push(n); // save the one closest to the tail
For one: could there not be multiple such SafePoints? If so: what does it mean to take "the closest"? And we may have multiple backedges / tails, now that we allow irreducible loops.
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.
Other than that the fix looks reasonable to me, thanks for the fix @rwestrel !
@eme64 thanks for reviewing this (and making suggestions). Does the updated change look ok? |
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.
Thanks for the changes @rwestrel , looks good now!
@TobiHartmann @eme64 thanks for the reviews. |
/integrate |
Going to push as commit 690d626.
Your commit was automatically rebased without conflicts. |
The test contains a loop nest with 2 loops. The outer loop is an
irreducible loop. The safepoint for that loop is also in the inner
loop. Because
IdealLoopTree::check_safepts()
ignores irreducibleloops, that safepoint is not marked as being required and is
eliminated from the inner loop. The inner loop is then optimized out
and the outer loop becomes an infinite loop with no safepoint (a
single node loop). That, in turn, causes the loop to be eliminated
because it has not use and the assert fires.
The fix I propose is to make
IdealLoopTree::check_safepts()
workwith irreducible loops. I think
IdealLoopTree::allpaths_check_safepts()
can be used for that. Whenworking on this I wondered if that method could be called with a loop
whose head has more than 3 inputs. I couldn't write a test case with
an irreducible loop whose head had more than 3 inputs but I added an
assert in the method and ran some testing. That assert fired so I also
propose to tweak the method so it's robust in that case.
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/14522/head:pull/14522
$ git checkout pull/14522
Update a local copy of the PR:
$ git checkout pull/14522
$ git pull https://git.openjdk.org/jdk.git pull/14522/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 14522
View PR using the GUI difftool:
$ git pr show -t 14522
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/14522.diff
Webrev
Link to Webrev Comment