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

8271056: C2: "assert(no_dead_loop) failed: dead loop detected" due to cmoving identity #6172

Closed
wants to merge 1 commit into from

Conversation

chhagedorn
Copy link
Member

@chhagedorn chhagedorn commented Oct 29, 2021

In the testcase, an unsafe cmoving identity is applied in PhiNode::Identity() after parsing which replaces a loop phi in a dead loop creating a dead data loop which triggers the assertion. The problem is that PhiNode::Identity() assumes that a cmoving identity is always safe because PhiNode::Ideal() handles unsafe cases and only leaves safe cases to PhiNode::Identity():

// Check for CMove'ing identity. If it would be unsafe,
// handle it here. In the safe case, let Identity handle it.
Node* unsafe_id = is_cmove_id(phase, true_path);
if( unsafe_id != NULL && is_unsafe_data_reference(unsafe_id) )
opt = unsafe_id;

However, the fix for JDK-8268883 added the following additional condition to wait for the region to be processed:

// If one of the diamond's branch is in the process of dying then, the Phi's input for that branch might transform
// to top. If that happens replacing the Phi with an operation that consumes the Phi's inputs will cause the Phi
// to be replaced by top. To prevent that, delay the transformation until the branch has a chance to be removed.
!(can_reshape && wait_for_region_igvn(phase))) {
// Check for CMove'ing identity. If it would be unsafe,
// handle it here. In the safe case, let Identity handle it.
Node* unsafe_id = is_cmove_id(phase, true_path);

This skips the process of an unsafe case in PhiNode::Ideal() in the testcase. Afterwards, the unsafe case is replaced unconditionally in PhiNode::Identity() resulting in a dead data loop.

I therefore propose to add the same check added in JDK-8268883 to PhiNode::Identity() to prevent that.

Thanks,
Christian


Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed

Issue

  • JDK-8271056: C2: "assert(no_dead_loop) failed: dead loop detected" due to cmoving identity

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/6172/head:pull/6172
$ git checkout pull/6172

Update a local copy of the PR:
$ git checkout pull/6172
$ git pull https://git.openjdk.java.net/jdk pull/6172/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 6172

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/6172.diff

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented Oct 29, 2021

👋 Welcome back chagedorn! 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 label Oct 29, 2021
@openjdk
Copy link

@openjdk openjdk bot commented Oct 29, 2021

@chhagedorn 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 label Oct 29, 2021
@mlbridge
Copy link

@mlbridge mlbridge bot commented Oct 29, 2021

Webrevs

Copy link
Contributor

@vnkozlov vnkozlov left a comment

Looks good. Thanks!

@openjdk
Copy link

@openjdk openjdk bot commented Oct 29, 2021

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

8271056: C2: "assert(no_dead_loop) failed: dead loop detected" due to cmoving identity

Reviewed-by: kvn, thartmann

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

  • 0395e4e: 8276768: Snippet copy feature should use button instead of link
  • d8b0dee: 8276239: Better tables in java.util.random package summary
  • fc0fe25: 8273235: tools/launcher/HelpFlagsTest.java Fails on Windows 32bit
  • 3934fe5: 8275847: Scheduling fails with "too many D-U pinch points" on small method
  • 44047f8: 8274328: C2: Redundant CFG edges fixup in block ordering
  • 8849154: 8275846: read_base_archive_name() could read past the end of buffer
  • 2653cfb: 8276688: Remove JLinkReproducibleXXXTest from ProblemList.txt
  • c7095b2: 8276207: Properties.loadFromXML/storeToXML works incorrectly for supplementary characters
  • ed7ecca: 8254739: G1: Optimize evacuation failure for regions with few failed objects
  • 59c3dcc: 8276746: Add section on reproducible builds in building.md
  • ... and 268 more: https://git.openjdk.java.net/jdk/compare/9d191fce55fa70d6a2affc724fad57b0e20e4bde...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 label Oct 29, 2021
@chhagedorn
Copy link
Member Author

@chhagedorn chhagedorn commented Nov 1, 2021

Thanks Vladimir for your review!

Copy link
Member

@TobiHartmann TobiHartmann left a comment

Looks good to me.

@chhagedorn
Copy link
Member Author

@chhagedorn chhagedorn commented Nov 8, 2021

Thanks Tobias for your review!

@chhagedorn
Copy link
Member Author

@chhagedorn chhagedorn commented Nov 8, 2021

/integrate

@openjdk
Copy link

@openjdk openjdk bot commented Nov 8, 2021

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

  • 0395e4e: 8276768: Snippet copy feature should use button instead of link
  • d8b0dee: 8276239: Better tables in java.util.random package summary
  • fc0fe25: 8273235: tools/launcher/HelpFlagsTest.java Fails on Windows 32bit
  • 3934fe5: 8275847: Scheduling fails with "too many D-U pinch points" on small method
  • 44047f8: 8274328: C2: Redundant CFG edges fixup in block ordering
  • 8849154: 8275846: read_base_archive_name() could read past the end of buffer
  • 2653cfb: 8276688: Remove JLinkReproducibleXXXTest from ProblemList.txt
  • c7095b2: 8276207: Properties.loadFromXML/storeToXML works incorrectly for supplementary characters
  • ed7ecca: 8254739: G1: Optimize evacuation failure for regions with few failed objects
  • 59c3dcc: 8276746: Add section on reproducible builds in building.md
  • ... and 268 more: https://git.openjdk.java.net/jdk/compare/9d191fce55fa70d6a2affc724fad57b0e20e4bde...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot closed this Nov 8, 2021
@openjdk openjdk bot added integrated and removed ready rfr labels Nov 8, 2021
@openjdk
Copy link

@openjdk openjdk bot commented Nov 8, 2021

@chhagedorn Pushed as commit 5448139.

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

@chhagedorn chhagedorn deleted the JDK-8271056 branch Nov 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hotspot-compiler integrated
3 participants