-
Notifications
You must be signed in to change notification settings - Fork 6.2k
8334724: C2: remove PhaseIdealLoop::cast_incr_before_loop() #19831
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
Conversation
|
👋 Welcome back roland! A progress list of the required criteria for merging this PR into |
|
@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: 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 45 new commits pushed to the
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 |
Webrevs
|
chhagedorn
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks reasonable to do but could also potentially be a risk. However, I've run t1-7 testing without finding anything and we are early in the release for JDK 24. So, I guess we could take the risk.
src/hotspot/share/opto/loopnode.hpp
Outdated
| // Check for aggressive application of 'split-if' optimization, | ||
| bool split_thru_phi_could_prevent_vectorization(Node* n, Node* n_blk); | ||
|
|
||
| // Check for aggressive application of 'split-if' optimization, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| // Check for aggressive application of 'split-if' optimization, | |
| // Check for aggressive application of 'split-if' optimization, |
vnkozlov
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
|
Christian ran performance testing with this change and reported 2 regressions: Crypto-ChaCha20Poly1305.decrypt - Windows x64: For the regression on windows: For the regression on macos: he reported a smaller regression (-2%) no regression anymore. |
|
@rwestrel This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration! |
|
@vnkozlov what do you think of the comment above about performance regressions? In your opinion, is it enough data to proceed with the change as is? |
|
I am not comfortable with big regression on MacOSX aarch64 even if you can't reproduce it locally. We need to rerun that testing to make sure it is random as you said. Please, merge latest JDK. |
Christian ran performance testing again (thanks Christian!) and there was no regression this time. |
vnkozlov
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good.
chhagedorn
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will run some testing again with latest master, just to be sure.
|
Testing passed! |
|
@vnkozlov @chhagedorn thanks for the reviews and testing. |
|
/integrate |
|
Going to push as commit 3a88fd4.
Your commit was automatically rebased without conflicts. |
I propose removing
PhaseIdealLoop::cast_incr_before_loop()and theCastIInodes that it adds at counted loop heads.They were added to prevent nodes to float above the zero trip guard
when the backedge of a counted loop is removed. In particular, when a
range check is hoisted by predication, pre/main/post loops are created
and if one of the main or post loops lose its backedge, an array load
that's control dependent on a predicate above the pre loop could float
above the zero trip guard of the main or post loop. That can no longer
happen AFAICT with changes related to assert predicates. The array
load is now updated to have a control dependency that's below the zero
trip guard.
The reason I'm revisiting this is that I noticed that
PhaseIdealLoop::cast_incr_before_loop()has a bug. When it adds theCastII, it looks for the loop phi and picks input 1 of the phi itfinds as input to the
CastII. To find the loop phi, it starts fromthe loop incremement and loop for a use that's a phi and has the loop
head as control. It never checks that the phi it finds is the loop
phi. There can be more than one phi as uses of the increment at the
loop head and it can pick the wrong one. I tried to write a test case
where this would cause a bug but couldn't actually find any use for
the
CastIIanymore.In my testing, the only issue when the
CastIIare not added is thatsome IR tests for vectorization fails:
compiler/vectorization/TestPopulateIndex.java
compiler/vectorization/runner/ArrayShiftOpTest.java
compiler/vectorization/runner/LoopArrayIndexComputeTest.java
because removing the
CastIIcauses split if to occur with some nodesthat take the loop phi as input. That then causes pattern matching
during superword to break. I added logic to prevent split if for those
cases.
Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/19831/head:pull/19831$ git checkout pull/19831Update a local copy of the PR:
$ git checkout pull/19831$ git pull https://git.openjdk.org/jdk.git pull/19831/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 19831View PR using the GUI difftool:
$ git pr show -t 19831Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/19831.diff
Webrev
Link to Webrev Comment