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

8309902: C2: assert(false) failed: Bad graph detected in build_loop_late after JDK-8305189 #14672

Closed
wants to merge 1 commit into from

Conversation

rwestrel
Copy link
Contributor

@rwestrel rwestrel commented Jun 27, 2023

The crash happens after the following steps:

1- pre/main/post loops are created with assert predicates above the main loop.

2- the main loop is peeled

3- as a consequence, the OpaqueZeroTripGuard for the main loop is removed

4- That allows narrowing of the type of the CastII that was added right
after the zero trip guard during pre/main/post loops creation

5- The CastII feeds into a range check CastII for the peeled iteration
that becomes top because the narrowed type of the first CastII
conflicts with the type recorded in the range check CastII.

6- The assert predicate that should fold to protect the range check
CastII doesn't because of the fix for JDK-8282592: on assert
predicate updates, the CastII at the zero trip guard is skipped. So
the range check CastII sees the narrowing of the type of the CastII
at the zero trip guard but the assert predicate doesn't.

The fix I propose is to revert that part of the change from
JDK-8282592 so both the range check CastII and the assert predicate
have the CastII at the zero trip guard as input and observe its type
updates. I went back to that bug and tried to reproduce the failure
again but couldn't. Reverting JDK-8281429 causes the bug to reproduce
again. I tried tweaking the test so the crash reproduces with
JDK-8281429 applied but couldn't.

This is caused by JDK-8305189 because step 3- happens because of
it. Before JDK-8305189, 3- happened after loop opts are over. I think
what happened then was that a template assertion predicate that was in
the process of having its OpaqueLoopInit and OpaqueLoopStride
removed constant folded so the crash wouldn't reproduce.


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-8309902: C2: assert(false) failed: Bad graph detected in build_loop_late after JDK-8305189 (Bug - P3)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 14672

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

Using diff file

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

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Jun 27, 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 Jun 27, 2023
@openjdk
Copy link

openjdk bot commented Jun 27, 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 Jun 27, 2023
@mlbridge
Copy link

mlbridge bot commented Jun 27, 2023

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.

Looks good.

@openjdk
Copy link

openjdk bot commented Jun 28, 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:

8309902: C2: assert(false) failed: Bad graph detected in build_loop_late after JDK-8305189

Reviewed-by: kvn, 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 88 new commits pushed to the master branch:

  • 690d626: 8307927: C2: "malformed control flow" with irreducible loop
  • be64d3a: 8310299: C2: 8275201 broke constant folding of array store check in some cases
  • b2eae16: 8295191: IR framework timeout options expect ms instead of s
  • af319d9: 8311064: Windows builds fail without precompiled headers after JDK-8310728
  • cbf418a: 8311020: Typo cleanup in Classfile API
  • f4b900b: 8310902: (fc) FileChannel.transferXXX async close and interrupt issues
  • cf8d706: 8308463: Refactor regenerated class handling in lambdaFormInvokers.cpp
  • 6f58ab2: 8301569: jmod list option and jimage list --help not interpreted correctly on turkish locale
  • 8f5a384: 8311032: Empty value for java.protocol.handler.pkgs system property can lead to unnecessary classloading attempts of protocol handlers
  • ded1370: 8309811: BytecodePrinter cannot handle unlinked classes
  • ... and 78 more: https://git.openjdk.org/jdk/compare/7628da200833d0d26215a91afdd1bf7fc110da1d...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 Jun 28, 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 reasonable. I will also remove any skipping of cast nodes in my patch for JDK-8288981.

@rwestrel
Copy link
Contributor Author

@vnkozlov @chhagedorn thanks for the reviews

@rwestrel
Copy link
Contributor Author

/integrate

@openjdk
Copy link

openjdk bot commented Jun 29, 2023

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

  • 05c2b6c: 8309979: BootstrapMethods attribute is missing in class files recreated by SA
  • 20f7d05: 8310502: Optimization for j.l.Long.fastUUID()
  • 07734f6: 8310848: Convert ClassDesc and MethodTypeDesc to be stored in static final fields
  • e5744b8: 8310919: runtime/ErrorHandling/TestAbortVmOnException.java times out due to core dumps taking a long time on OSX
  • 98a954e: 8308286: Fix clang warnings in linux code
  • f842ec4: 8305667: Some fonts installed in user directory are not detected on Windows
  • 690d626: 8307927: C2: "malformed control flow" with irreducible loop
  • be64d3a: 8310299: C2: 8275201 broke constant folding of array store check in some cases
  • b2eae16: 8295191: IR framework timeout options expect ms instead of s
  • af319d9: 8311064: Windows builds fail without precompiled headers after JDK-8310728
  • ... and 84 more: https://git.openjdk.org/jdk/compare/7628da200833d0d26215a91afdd1bf7fc110da1d...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Jun 29, 2023

@rwestrel Pushed as commit 26efff7.

💡 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
Development

Successfully merging this pull request may close these issues.

3 participants