jdk icon indicating copy to clipboard operation
jdk copied to clipboard

8291669: [REDO] Fix array range check hoisting for some scaled loop iv

Open pfustc opened this issue 2 years ago • 3 comments

This is a REDO of JDK-8289996. In previous patch, we defer some strength reductions in Ideal functions of Mul[I|L]Node to post loop igvn phase to fix a range check hoisting issue. More about previous patch can be found in PR #9508, where we have described some details of the issue we would like to fix.

Previous patch was backed out due to some jtreg failures found. We have analyzed those failures one by one and found one of them exposes a real performance regression. We see that deferring some strength reductions to post loop igvn phase has too much impact. Some vector multiplication will not be optimized to vector addition with vector shift after that change. So in this REDO we propose the range check hoisting fix with a different approach.

In this new patch, we add some recursive pattern matches for scaled loop iv in function PhaseIdealLoop::is_scaled_iv(). These include matching a sum or a difference of two scaled iv expressions. With this, all kinds of Ideal-transformed scaled iv expressions can still be recognized. This new approach only touches loop transformation code and hence has much smaller impact. We have verified that this new approach applies to both int range checks and long range checks.

Previously attached jtreg case fails on ppc64 because VectorAPI has no vector intrinsics on ppc64 so there's no long range check to hoist. In this patch, we limit the test architecture to x64 and AArch64.

Tested hotspot::hotspot_all_no_apps, jdk::tier1~3 and langtools::tier1.


Progress

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

Issue

  • JDK-8291669: [REDO] Fix array range check hoisting for some scaled loop iv

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 9851

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

Using diff file

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

pfustc avatar Aug 12 '22 09:08 pfustc

:wave: Welcome back pli! 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.

bridgekeeper[bot] avatar Aug 12 '22 09:08 bridgekeeper[bot]

@pfustc 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[bot] avatar Aug 12 '22 09:08 openjdk[bot]

Webrevs

mlbridge[bot] avatar Aug 12 '22 09:08 mlbridge[bot]

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

8291669: [REDO] Fix array range check hoisting for some scaled loop iv

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

  • 7f3250d71c4866a64eb73f52140c669fe90f122f: 8293787: Linux aarch64 build fails after 8292591
  • 2a3879180e63aa0a7a19479f061fe78d7885da7b: 8292755: Non-default method in interface leads to a stack overflow in JShell
  • 8351b30e009d5183e87277aba654cff6a6b7ab0d: 8293771: runtime/handshake/SystemMembarHandshakeTransitionTest.java fails if MEMBARRIER_CMD_QUERY is unsupported
  • 91f9c0d0cfd3d328aaec05254925d1b15611cd6e: 8293774: Improve TraceOptoParse to dump the bytecode name
  • 1169a1593660242375400e9d6b9ca11a872cdf02: 8291657: Javac assertion when compiling a method call with switch expression as argument
  • 2baf2516e1d172268ec7c4c066a1b53bb0bf0779: 8293654: Improve SharedRuntime handling of continuation helper out-arguments
  • 60f59a4a8808abf1a8896ca122a1f8120c9f5527: 8293660: Fix frame::sender_for_compiled_frame frame size assert
  • b3461c188a1d364a71e2ef7f6b2ccc29dd3ac66f: 8293680: PPC64BE build failure after JDK-8293344
  • 7e0203980582c47e53f8851998138e13913bd28a: 8293647: Avoid unnecessary boxing in jdk.hotspot.agent
  • 90390222bd215ff10040ecde5efcdf33a05f33ae: 8287394: AArch64: Remove cbuf parameter from far_call/far_jump/trampoline_call
  • ... and 361 more: https://git.openjdk.org/jdk/compare/0c40128fec41cf69821dbf7f1b19600560e8ac12...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[bot] avatar Sep 02 '22 06:09 openjdk[bot]

May I have another review for this REDO? Perhaps @vnkozlov @TobiHartmann

pfustc avatar Sep 05 '22 13:09 pfustc

Thanks for review. I will integrate this.

pfustc avatar Sep 14 '22 14:09 pfustc

/integrate

pfustc avatar Sep 14 '22 14:09 pfustc

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

  • 7f3250d71c4866a64eb73f52140c669fe90f122f: 8293787: Linux aarch64 build fails after 8292591
  • 2a3879180e63aa0a7a19479f061fe78d7885da7b: 8292755: Non-default method in interface leads to a stack overflow in JShell
  • 8351b30e009d5183e87277aba654cff6a6b7ab0d: 8293771: runtime/handshake/SystemMembarHandshakeTransitionTest.java fails if MEMBARRIER_CMD_QUERY is unsupported
  • 91f9c0d0cfd3d328aaec05254925d1b15611cd6e: 8293774: Improve TraceOptoParse to dump the bytecode name
  • 1169a1593660242375400e9d6b9ca11a872cdf02: 8291657: Javac assertion when compiling a method call with switch expression as argument
  • 2baf2516e1d172268ec7c4c066a1b53bb0bf0779: 8293654: Improve SharedRuntime handling of continuation helper out-arguments
  • 60f59a4a8808abf1a8896ca122a1f8120c9f5527: 8293660: Fix frame::sender_for_compiled_frame frame size assert
  • b3461c188a1d364a71e2ef7f6b2ccc29dd3ac66f: 8293680: PPC64BE build failure after JDK-8293344
  • 7e0203980582c47e53f8851998138e13913bd28a: 8293647: Avoid unnecessary boxing in jdk.hotspot.agent
  • 90390222bd215ff10040ecde5efcdf33a05f33ae: 8287394: AArch64: Remove cbuf parameter from far_call/far_jump/trampoline_call
  • ... and 361 more: https://git.openjdk.org/jdk/compare/0c40128fec41cf69821dbf7f1b19600560e8ac12...master

Your commit was automatically rebased without conflicts.

openjdk[bot] avatar Sep 14 '22 14:09 openjdk[bot]

@pfustc Pushed as commit 211fab8d361822bbd1a34a88626853bf4a029af5.

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

openjdk[bot] avatar Sep 14 '22 14:09 openjdk[bot]