-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
8351414: C2: MergeStores must happen after RangeCheck smearing #23944
Conversation
👋 Welcome back epeter! A progress list of the required criteria for merging this PR into |
@eme64 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 26 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 |
Do you think it would make sense to make a dedicated |
Hmm, maybe? Can you say a little more how you imagine it? |
@merykitty I basically just copied the structure from |
I would imagine |
@merykitty I'm not sure if I understood you right. You seem to say that I should do this (please correct me):
This is really a fix for Valhalla, see https://bugs.openjdk.org/browse/JDK-8348959, so it would be nice to fix this rather sooner. If someone wants to then refactor the code later, that's fine with me ;) |
I think keeping a list is fine.
I think the logic would still be the same. We start at a store then try to find the last store in the chain, then group the stores and do the merge. After that, we can remove the replaced stores from the work list. It is global in the sense that we can freely walk the graph instead of being restricted to the current node that is invoking
while we can do
It is also better because idealisation of a store node may be invoked several times, leading to useless |
@eme64 I'm working on merging loads and I meet the same problem. I work around it by delay transform LoadNode after all range check smearing. But I think your solution is better. Could you change the name "_for_merge_stores_igvn" as "_for_merge_mem_igvn" and it can be used both for store and loads? |
@merykitty Thanks for giving more details. I agree that your idea would lead to some fewer adjacency checks, and so it would be somewhat desirable to do that. However, splitting out the I personally have decided to only put minimal effort into MergeStores, my priorities are elsewhere. This issue here is primarily addressing the problems in the Valhalla repo, where the issues with the order of RC smearing and MergeStores is somehow more apparent than on mainline. So if you feel that this idea is important to you, feel free to file an RFE, maybe someone else wants to take this effort on. @kuaiwei I think for now I'll leave it with |
Webrevs
|
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.
Thanks for the elaboration. LGTM.
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!
// We need to wait with merging stores until RangeCheck smearing has removed the RangeChecks during | ||
// the post loops IGVN phase. If we do it earlier, then there may still be some RangeChecks between | ||
// the stores, and we merge the wrong sequence of stores. | ||
// Example: | ||
// StoreI RangeCheck StoreI StoreI RangeCheck StoreI | ||
// Apply MergeStores: | ||
// StoreI RangeCheck [ StoreL ] RangeCheck StoreI | ||
// Remove more RangeChecks: | ||
// StoreI [ StoreL ] StoreI | ||
// But now it would have been better to do this instead: | ||
// [ StoreL ] [ StoreL ] |
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.
Maybe you also can add a note here that RC smearing is not limited to just this one IGVN phase but that it's done in all subsequent IGVN phases (since we don't unset _merge_stores_phase
).
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 added a comment below :)
Thanks @chhagedorn @merykitty for the reviews! /integrate |
Going to push as commit 4cf6316.
Your commit was automatically rebased without conflicts. |
With JDK-8348959 we see that there can be some issues when RangeCheck smearing happens in the same IGVN phase as MergeStores. It means that some RangeChecks are still around as we do MergeStores, and then we cannot merge as many stores as we would like. We should ensure that RangeCheck smearing happens during post-loop-opts, and then MergeStores happens in a separate dedicated IGVN round afterwards.
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/23944/head:pull/23944
$ git checkout pull/23944
Update a local copy of the PR:
$ git checkout pull/23944
$ git pull https://git.openjdk.org/jdk.git pull/23944/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 23944
View PR using the GUI difftool:
$ git pr show -t 23944
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/23944.diff
Using Webrev
Link to Webrev Comment