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

8280600: C2: assert(!had_error) failed: bad dominance #7307

Closed
wants to merge 3 commits into from

Conversation

rwestrel
Copy link
Contributor

@rwestrel rwestrel commented Feb 1, 2022

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

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

Issue

  • JDK-8280600: C2: assert(!had_error) failed: bad dominance

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

@bridgekeeper
Copy link

bridgekeeper bot commented Feb 1, 2022

👋 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 Feb 1, 2022
@openjdk
Copy link

openjdk bot commented Feb 1, 2022

@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 Feb 1, 2022
@mlbridge
Copy link

mlbridge bot commented Feb 1, 2022

Webrevs

Copy link
Contributor

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

Copy link
Contributor

@vnkozlov vnkozlov left a comment

Choose a reason for hiding this comment

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

Testing passed.

@openjdk
Copy link

openjdk bot commented Feb 2, 2022

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

8280600: C2: assert(!had_error) failed: bad dominance

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

  • 4304a77: 8279535: C2: Dead code in PhaseIdealLoop::create_loop_nest after JDK-8276116
  • ab63834: 8280885: Shenandoah: Some tests failed with "EA: missing allocation reference path"
  • 48a32b5: 8280976: Incorrect encoding of avx512 vpsraq instruction with mask and constant shift.
  • 97af323: 8280842: Access violation in ciTypeFlow::profiled_count
  • d32f99e: 8279219: [REDO] C2 crash when allocating array of size too large
  • 85d839f: 8280601: ClhsdbThreadContext.java test is triggering codecache related asserts
  • 9ca7ff3: 8281082: Improve javadoc references to JOSS
  • c74b8f4: 8275914: SHA3: changing java implementation to help C2 create high-performance code
  • a18beb4: 8280867: Cpuid1Ecx feature parsing is incorrect for AMD CPUs
  • fdd9ca7: 8280642: ObjectInputStream.readObject should throw InvalidClassException instead of IllegalAccessError
  • ... and 42 more: https://git.openjdk.java.net/jdk/compare/973dda5ce0747a8ea67ec3a34c2ef2a0b2b6b140...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 Feb 2, 2022
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 reasonable to me.

public static void main(String[] k) {
TestCastIIMakesMainLoopPhiDead t = new TestCastIIMakesMainLoopPhiDead();
for (int i = 0; i < 3; i++) {
t.test();
Copy link
Member

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).

@rwestrel
Copy link
Contributor Author

rwestrel commented Feb 2, 2022

@vnkozlov thanks for review and testing
@TobiHartmann thanks for the review. I will fix indentation before I push the change.

@rwestrel
Copy link
Contributor Author

rwestrel commented Feb 2, 2022

/integrate

@openjdk
Copy link

openjdk bot commented Feb 2, 2022

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

  • 4304a77: 8279535: C2: Dead code in PhaseIdealLoop::create_loop_nest after JDK-8276116
  • ab63834: 8280885: Shenandoah: Some tests failed with "EA: missing allocation reference path"
  • 48a32b5: 8280976: Incorrect encoding of avx512 vpsraq instruction with mask and constant shift.
  • 97af323: 8280842: Access violation in ciTypeFlow::profiled_count
  • d32f99e: 8279219: [REDO] C2 crash when allocating array of size too large
  • 85d839f: 8280601: ClhsdbThreadContext.java test is triggering codecache related asserts
  • 9ca7ff3: 8281082: Improve javadoc references to JOSS
  • c74b8f4: 8275914: SHA3: changing java implementation to help C2 create high-performance code
  • a18beb4: 8280867: Cpuid1Ecx feature parsing is incorrect for AMD CPUs
  • fdd9ca7: 8280642: ObjectInputStream.readObject should throw InvalidClassException instead of IllegalAccessError
  • ... and 42 more: https://git.openjdk.java.net/jdk/compare/973dda5ce0747a8ea67ec3a34c2ef2a0b2b6b140...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Feb 2, 2022

@rwestrel Pushed as commit de826ba.

💡 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