Skip to content
This repository has been archived by the owner on Sep 19, 2023. It is now read-only.

8288445: AArch64: C2 compilation fails with guarantee(!true || (true && (shift != 0))) failed: impossible encoding #40

Closed
wants to merge 8 commits into from

Conversation

dean-long
Copy link
Member

@dean-long dean-long commented Jun 17, 2022

The range for aarch64 vector right-shift is 1 to the element width. This issue fixes the problem in the back-end. There is a separate problem in the front-end that shift by 0 is not always optimized out.


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-8288445: AArch64: C2 compilation fails with guarantee(!true || (true && (shift != 0))) failed: impossible encoding

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 40

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk19/pull/40.diff

@bridgekeeper
Copy link

bridgekeeper bot commented Jun 17, 2022

👋 Welcome back dlong! 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
Copy link

openjdk bot commented Jun 17, 2022

@dean-long 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 17, 2022
@dean-long dean-long changed the title JDKProject Type: software Backlog Active sprints Releases Reports Issues Components Add-ons Uploade8288445: AArch64: C2 compilation fails with guarantee(!true || (true && (shift != 0))) failed: impossible encoding 8288445: AArch64: C2 compilation fails with guarantee(!true || (true && (shift != 0))) failed: impossible encoding Jun 17, 2022
@openjdk openjdk bot added the rfr Pull request is ready for review label Jun 17, 2022
@mlbridge
Copy link

mlbridge bot commented Jun 17, 2022

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.

What instruction will the zero-shift be matched with then?

test/hotspot/jtreg/compiler/codegen/ShiftByZero.java Outdated Show resolved Hide resolved
test/hotspot/jtreg/compiler/codegen/ShiftByZero.java Outdated Show resolved Hide resolved
@shqking
Copy link

shqking commented Jun 20, 2022

Instead of introducing immI_positive, I wonder if we can generate orr dst src for zero shift count, just as the SVE part does. E.g., https://github.com/openjdk/jdk19/blob/master/src/hotspot/cpu/aarch64/aarch64_sve.ad#L3667

Co-authored-by: Tobias Hartmann <tobias.hartmann@oracle.com>
@dean-long
Copy link
Member Author

What instruction will the zero-shift be matched with then?

The shift instruction that takes a vector register shift count rather than an immediate.

@dean-long
Copy link
Member Author

Instead of introducing immI_positive, I wonder if we can generate orr dst src for zero shift count, just as the SVE part does

I considered using left-shift by 0, but I don't think it's worth it to optimize this case in the back-end. If we really want to optimize shift by 0, I think it should be done in the front-end.

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.

@openjdk
Copy link

openjdk bot commented Jun 22, 2022

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

8288445: AArch64: C2 compilation fails with guarantee(!true || (true && (shift != 0))) failed: impossible encoding

Reviewed-by: thartmann, haosun, njian

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

  • 9c92da5: 8247407: tools/jlink/plugins/CompressorPluginTest.java test failing
  • 7ac40f3: 8288983: broken link in com.sun.net.httpserver.SimpleFileServer
  • 20f55ab: 8289044: ARM32: missing LIR_Assembler::cmove metadata type support
  • bdf9902: 8288120: VerifyError with JEP 405 pattern match
  • b0db333: 8288528: broken links in java.desktop
  • 651cbeb: 8288080: (fc) FileChannel::map for MemorySegments should state it always throws UOE
  • 1f9521e: 8287076: Document.normalizeDocument() produces different results
  • a716f79: 8288589: Files.readString ignores encoding errors for UTF-16
  • 4c9ea7e: 8286580: serviceability/jvmti/vthread/GetSetLocalTest failed with assert: Not supported for heap frames
  • 3f5e48a: 8288781: C1: LIR_OpVisitState::maxNumberOfOperands too small
  • ... and 28 more: https://git.openjdk.org/jdk19/compare/ff3db52044f69754b1ccf54961f453d4afbfba3a...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 22, 2022
@shqking
Copy link

shqking commented Jun 22, 2022

Instead of introducing immI_positive, I wonder if we can generate orr dst src for zero shift count, just as the SVE part does

I considered using left-shift by 0, but I don't think it's worth it to optimize this case in the back-end. If we really want to optimize shift by 0, I think it should be done in the front-end.

Okay.

I think we may want to make the same update to the corresponding SVE part, e.g. https://github.com/openjdk/jdk/blob/master/src/hotspot/cpu/aarch64/aarch64_sve.ad#L3662, as it's better to align with the NEON and SVE implementations.

It may deserve one separate patch, not in this bugfix one.

@dean-long
Copy link
Member Author

Thanks Tobias.

@dean-long
Copy link
Member Author

@shqking Yes, that's a good idea for a separate RFE targeted for jdk20.

Copy link

@shqking shqking left a comment

Choose a reason for hiding this comment

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

LGTM (I'm not a Reviewer).

Co-authored-by: Andrew Haley <aph-open@littlepinkcloud.com>
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Jun 23, 2022
Co-authored-by: Hao Sun <hao.sun@arm.com>
@openjdk openjdk bot added ready Pull request is ready to be integrated rfr Pull request is ready for review labels Jun 24, 2022
Copy link

@nsjian nsjian 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.

@dean-long
Copy link
Member Author

Thanks @nsjian, @shqking, and @theRealAph.

@dean-long
Copy link
Member Author

/integrate

@openjdk
Copy link

openjdk bot commented Jun 28, 2022

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

  • 2efa89a: 8289251: ProblemList java/lang/ref/OOMEInReferenceHandler.java
  • 17ef8ca: 8288524: Allow @systemProperty to appear in overview documentation
  • caa6b74: 8289240: ProblemList java/lang/reflect/callerCache/ReflectionCallerCacheTest.java in -Xcomp mode
  • 28913f4: 8289235: ProblemList vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod011/TestDescription.java when run with vthread wrapper
  • 7746664: 8280826: Document set of strings javac recognizes for SuppressWarnings
  • 2c8ada6: 8289188: SegmentAllocator:allocateArray(*) default behavior mismatch to spec
  • 699ad45: 8289093: BlockLocationPrinter fails to decode addresses with G1
  • 784a0f0: 8288683: C2: And node gets wrong type due to not adding it back to the worklist in CCP
  • 7e13cdb: 8289079: java/lang/Thread/jni/AttachCurrentThread/AttachTest.java#id1 failed with "RuntimeException: Test failed"
  • 9c92da5: 8247407: tools/jlink/plugins/CompressorPluginTest.java test failing
  • ... and 37 more: https://git.openjdk.org/jdk19/compare/ff3db52044f69754b1ccf54961f453d4afbfba3a...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Jun 28, 2022

@dean-long Pushed as commit b449038.

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

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