Skip to content
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

8315920: C2: "control input must dominate current control" assert failure #15720

Closed
wants to merge 8 commits into from

Conversation

rwestrel
Copy link
Contributor

@rwestrel rwestrel commented Sep 13, 2023

The assert fires during range check eliminationin code that was added
recently. It catches a bug that's been going unnoticed. The array[0]
load of the test case ends up on the exit of the loop above it. After
pre/main/post loops are created for this loop (the inner loop is
optimized out), the load is at a region merging control from the just
created pre/main/post loops but its control (as returned by
PhaseIdealLoop::get_ctrl()) is not updated by pre/main/post loops
creation code so it's still the exit projection of one of the
loops. This causes the assert to fire (the load has bad control) when
RC runs next in the same loop opts pass.

The current logic for pre/main/post loops creation does update the
control of nodes on an exit projection but only if the node is
referenced from some other node in the loop body.

I think a similar bug with a node assigned control at the exit but not
pinned is likely to exist. So I doubt simply going over nodes pinned
at exits during pre/main/post and updating their control is good
enough. What I propose instead is to lazy_replace() the projection
by the region so that, for all nodes that are assigned the exit as
control, get_ctrl() will then return the region. It's not entirely
straightforward to implement because the lazy_replace() mechanism
assumes the control being replaced is dead which is not the case
here. That's why in the patch the exit projection is cloned so the
existing one is dead and can be used in lazy_replace(). This also
makes the calls to sink_use() redundant.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8315920: C2: "control input must dominate current control" assert failure (Bug - P3)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/15720/head:pull/15720
$ git checkout pull/15720

Update a local copy of the PR:
$ git checkout pull/15720
$ git pull https://git.openjdk.org/jdk.git pull/15720/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 15720

View PR using the GUI difftool:
$ git pr show -t 15720

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/15720.diff

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Sep 13, 2023

👋 Welcome back roland! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk openjdk bot added the rfr Pull request is ready for review label Sep 13, 2023
@openjdk
Copy link

openjdk bot commented Sep 13, 2023

@rwestrel The following label will be automatically applied to this pull request:

  • hotspot-compiler

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.

@openjdk openjdk bot added the hotspot-compiler hotspot-compiler-dev@openjdk.org label Sep 13, 2023
@mlbridge
Copy link

mlbridge bot commented Sep 13, 2023

Webrevs

Copy link
Member

@TobiHartmann TobiHartmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me but needs some more comments.

@@ -1918,6 +1918,8 @@ Node *PhaseIdealLoop::insert_post_loop(IdealLoopTree* loop, Node_List& old_new,
post_head->set_normal_loop();
post_head->set_post_loop(main_head);

main_exit = outer_main_end->proj_out(false);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a comment explaining that/why the main_exit projection changed.

src/hotspot/share/opto/loopopts.cpp Outdated Show resolved Hide resolved
src/hotspot/share/opto/loopopts.cpp Outdated Show resolved Hide resolved
src/hotspot/share/opto/loopopts.cpp Outdated Show resolved Hide resolved
@@ -2223,10 +2212,6 @@ void PhaseIdealLoop::clone_loop_handle_data_uses(Node* old, Node_List &old_new,
if( hit ) // Go ahead and re-hash for hits.
_igvn.replace_node( use, hit );
}

// If 'use' was in the loop-exit block, it now needs to be sunk
// below the post-loop merge point.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment needs to be moved to the new lazy-replace logic and cloning needs to be explained there as well.

@openjdk
Copy link

openjdk bot commented Sep 15, 2023

@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:

8315920: C2: "control input must dominate current control" assert failure

Reviewed-by: thartmann, chagedorn

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 96 new commits pushed to the master branch:

  • 20ff603: 8316735: Print LockStack in hs_err files
  • e510dee: 8316098: Revise signature of numa_get_leaf_groups
  • 1513e79: 8316940: Serial: Remove unused declarations in genCollectedHeap
  • 52983ed: 8303737: C2: Load can bypass subtype check that enforces it's from the right object type
  • 9e6cb62: 8316851: Add @sealedGraph to Executable
  • 3fe6e0f: 8308479: [s390x] Implement alternative fast-locking scheme
  • e2e8e8e: 8312136: Modify runtime/ErrorHandling/TestDwarf.java to split dwarf and decoder testing
  • 0dce4c1: 8313220: Remove Windows specific workaround in LCMS.c for _snprintf
  • e5f05b5: 8312191: ColorConvertOp.filter for the default destination is too slow
  • be9cc73: 8315871: Opensource five more Swing regression tests
  • ... and 86 more: https://git.openjdk.org/jdk/compare/62c0a1b9ac6462233f3ee06af470be9844e9e226...master

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 master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Sep 15, 2023
Copy link
Member

@chhagedorn chhagedorn left a 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.

@@ -2630,12 +2613,18 @@ void PhaseIdealLoop::fix_ctrl_uses(const Node_List& body, const IdealLoopTree* l
l -= uses_found; // we deleted 1 or more copies of this edge
}

assert(use->is_Proj(), "loop exit should be projections");
Node* use_clone = use->clone();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe also add a comment here why you need to clone the node for lazy_replace().

src/hotspot/share/opto/loopopts.cpp Outdated Show resolved Hide resolved
rwestrel and others added 6 commits September 25, 2023 14:55
Co-authored-by: Tobias Hartmann <tobias.hartmann@oracle.com>
Co-authored-by: Tobias Hartmann <tobias.hartmann@oracle.com>
Co-authored-by: Tobias Hartmann <tobias.hartmann@oracle.com>
Co-authored-by: Christian Hagedorn <christian.hagedorn@oracle.com>
@rwestrel
Copy link
Contributor Author

@TobiHartmann @chhagedorn thanks for reviewing this. I pushed a new commit with comments. Let me know if that looks ok to you.

Copy link
Member

@TobiHartmann TobiHartmann left a 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, thanks for adding the comments!

src/hotspot/share/opto/loopopts.cpp Outdated Show resolved Hide resolved
Co-authored-by: Tobias Hartmann <tobias.hartmann@oracle.com>
Copy link
Member

@chhagedorn chhagedorn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update, looks good!

@rwestrel
Copy link
Contributor Author

@TobiHartmann @chhagedorn thanks for the reviews.

@rwestrel
Copy link
Contributor Author

/integrate

@openjdk
Copy link

openjdk bot commented Sep 26, 2023

Going to push as commit 4e1e579.
Since your change was applied there have been 97 commits pushed to the master branch:

  • 1f7dfda: 8316671: sun/security/ssl/SSLSocketImpl/SSLSocketCloseHang.java test fails intermittent with Read timed out
  • 20ff603: 8316735: Print LockStack in hs_err files
  • e510dee: 8316098: Revise signature of numa_get_leaf_groups
  • 1513e79: 8316940: Serial: Remove unused declarations in genCollectedHeap
  • 52983ed: 8303737: C2: Load can bypass subtype check that enforces it's from the right object type
  • 9e6cb62: 8316851: Add @sealedGraph to Executable
  • 3fe6e0f: 8308479: [s390x] Implement alternative fast-locking scheme
  • e2e8e8e: 8312136: Modify runtime/ErrorHandling/TestDwarf.java to split dwarf and decoder testing
  • 0dce4c1: 8313220: Remove Windows specific workaround in LCMS.c for _snprintf
  • e5f05b5: 8312191: ColorConvertOp.filter for the default destination is too slow
  • ... and 87 more: https://git.openjdk.org/jdk/compare/62c0a1b9ac6462233f3ee06af470be9844e9e226...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Sep 26, 2023
@openjdk openjdk bot closed this Sep 26, 2023
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Sep 26, 2023
@openjdk
Copy link

openjdk bot commented Sep 26, 2023

@rwestrel Pushed as commit 4e1e579.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hotspot-compiler hotspot-compiler-dev@openjdk.org integrated Pull request has been integrated
3 participants