Skip to content

8278471: Remove unreached rules in AddNode::IdealIL #6752

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

Closed

Conversation

CptGit
Copy link
Contributor

@CptGit CptGit commented Dec 7, 2021

Reorder optimizations in addnode so special cases appear before general cases; otherwise the special cases would be never covered.

(a - b) + (c - d) subsumes both (a - b) + (b - c) and (a - b) + (c - a). Therefore (a - b) + (b - c) and (a - b) + (c - a) have to be placed before (a - b) + (c - d) so that they can work.


Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed

Issue

  • JDK-8278471: Remove unreached rules in AddNode::IdealIL

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/6752/head:pull/6752
$ git checkout pull/6752

Update a local copy of the PR:
$ git checkout pull/6752
$ git pull https://git.openjdk.java.net/jdk pull/6752/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 6752

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/6752.diff

@bridgekeeper
Copy link

bridgekeeper bot commented Dec 7, 2021

👋 Welcome back CptGit! 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 Dec 7, 2021

@CptGit 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 Dec 7, 2021
@openjdk
Copy link

openjdk bot commented Dec 8, 2021

@CptGit this pull request can not be integrated into master due to one or more merge conflicts. To resolve these merge conflicts and update this pull request you can run the following commands in the local repository for your personal fork:

git checkout reorder-optimizations-in-addnode-ideal
git fetch https://git.openjdk.java.net/jdk master
git merge FETCH_HEAD
# resolve conflicts and follow the instructions given by git merge
git commit -m "Merge master"
git push

@openjdk openjdk bot added the merge-conflict Pull request has merge conflict with target branch label Dec 8, 2021
@CptGit CptGit force-pushed the reorder-optimizations-in-addnode-ideal branch from 78b8f67 to 3fb1e7b Compare December 8, 2021 17:03
@openjdk openjdk bot removed the merge-conflict Pull request has merge conflict with target branch label Dec 8, 2021
@fmatte1
Copy link

fmatte1 commented Dec 9, 2021

related JBS issue - https://bugs.openjdk.java.net/browse/JDK-8278471

@CptGit CptGit changed the title [bug id TBD]: Reorder optimizations in addnode 8278471: Reorder optimizations in addnode Ideal Dec 9, 2021
@openjdk openjdk bot added the rfr Pull request is ready for review label Dec 9, 2021
@mlbridge
Copy link

mlbridge bot commented Dec 9, 2021

Webrevs

@merykitty
Copy link
Member

We actually don't need those since (x - c) + (c - y) would be transformed into (x + c) - (c + y) which will be transformed into x - y anyway. So you can safely remove them completely.

// Convert "(X+A) - (X+B)" into "A - B"

@CptGit
Copy link
Contributor Author

CptGit commented Dec 12, 2021

We actually don't need those since (x - c) + (c - y) would be transformed into (x + c) - (c + y) which will be transformed into x - y anyway. So you can safely remove them completely.

// Convert "(X+A) - (X+B)" into "A - B"

Thank you for pointing this out! I have two questions:

  1. Should I just go ahead and delete these two, (a - b) + (b - c) and (a - b) + (c - a), in this pr?

  2. I do see you are familiar with the concatenation of different optimizations. I was wondering where I am able to find more information about the order the functions are called, for example Ideal(), Value(), Identity(), or even better the entire workflow of optimization.

Thank you very much!

@merykitty
Copy link
Member

Hi, I think just deleting those 2 should be okay.

Regarding idealisation, if you look into PhaseGVN::transform, it is clear that Node::Ideal is called repeatedly until there is nothing change anymore. Then Node::Value is called to do constant propagation before Node::Identity is called to get rid of redundant operations. Finally, value numbering is the transformation which deduplicates all equivalent Nodes into a single one.

Node *PhaseGVN::transform( Node *n ) {

@CptGit
Copy link
Contributor Author

CptGit commented Dec 14, 2021

Hi, I think just deleting those 2 should be okay.

Regarding idealisation, if you look into PhaseGVN::transform, it is clear that Node::Ideal is called repeatedly until there is nothing change anymore. Then Node::Value is called to do constant propagation before Node::Identity is called to get rid of redundant operations. Finally, value numbering is the transformation which deduplicates all equivalent Nodes into a single one.

Node *PhaseGVN::transform( Node *n ) {

Thank you so much for answering both my questions!

Copy link
Member

@DamonFool DamonFool left a comment

Choose a reason for hiding this comment

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

LGTM

The removed rules actually never be reached before.
So removing them won't make performance any worse.

And the removed opts are already done by (AddNode::IdealIL + SubINode::Ideal).

However, it would be better to change the JBS title as something like 'Remove unreached rules in AddNode::IdealIL'
Thanks.

@openjdk
Copy link

openjdk bot commented Dec 14, 2021

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

8278471: Remove unreached rules in AddNode::IdealIL

Reviewed-by: jiefu, kvn

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

  • 0dbe4c5: 8278131: runtime/cds/appcds/dynamicArchive/* tests failing in loom repo
  • e6b28e0: Merge
  • d3408a4: 8277964: ClassCastException with no stack trace is thrown with -Xcomp in method handle invocation
  • 69b5d49: 8272064: test/jdk/jdk/jfr/api/consumer/TestHiddenMethod.java needs update for JEP 416
  • d6b5544: 8278607: Misc issues in foreign API javadoc
  • 918e339: 8278233: [macos] tools/jpackage tests timeout due to /usr/bin/osascript
  • f48a3e8: 8278758: runtime/BootstrapMethod/BSMCalledTwice.java fails with release VMs after JDK-8262134
  • 0cc989b: 8278744: KeyStore:getAttributes() not returning unmodifiable Set
  • 475ec8e: 8277919: OldObjectSample event causing bloat in the class constant pool in JFR recording
  • 32139c1: 8262134: compiler/uncommontrap/TestDeoptOOM.java failed with "guarantee(false) failed: wrong number of expression stack elements during deopt"
  • ... and 53 more: https://git.openjdk.java.net/jdk/compare/ec0a5ac8fec75c5c3eda3d9909d2e65d610d9854...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.

As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@DamonFool, @vnkozlov) but any other Committer may sponsor as well.

➡️ To flag this PR as ready for integration with the above commit message, type /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Dec 14, 2021
@CptGit
Copy link
Contributor Author

CptGit commented Dec 14, 2021

Thank you for your review. @DamonFool Would you mind making the change to JBS for me? I don't have an account there, so I am not able to edit. Thanks.

@DamonFool
Copy link
Member

Thank you for your review. @DamonFool Would you mind making the change to JBS for me? I don't have an account there, so I am not able to edit. Thanks.

The JBS title had been updated.
Thanks.

@CptGit CptGit changed the title 8278471: Reorder optimizations in addnode Ideal 8278471: Remove unreached rules in AddNode::IdealIL Dec 14, 2021
@CptGit
Copy link
Contributor Author

CptGit commented Dec 14, 2021

/integrate

@openjdk openjdk bot added the sponsor Pull request is ready to be sponsored label Dec 14, 2021
@openjdk
Copy link

openjdk bot commented Dec 14, 2021

@CptGit
Your change (at version d4d2b18) is now ready to be sponsored by a Committer.

@DamonFool
Copy link
Member

/integrate

Hi @CptGit , you need at least two reviews for hotspot changes.
So one more review is required.

@CptGit
Copy link
Contributor Author

CptGit commented Dec 14, 2021

/integrate

Hi @CptGit , you need at least two reviews for hotspot changes. So one more review is required.

It thought it can be integrated since the bot told me.Thanks for letting me know the requirement.

@lgxbslgx
Copy link
Member

/reviewers 2 reviewer

@openjdk
Copy link

openjdk bot commented Dec 15, 2021

@lgxbslgx Only the author of the pull request or Reviewers are allowed to change the number of required reviewers.

@lgxbslgx
Copy link
Member

@DamonFool Now we have the command reviewers to change the number of the required reviewers. Hope more developers know this.

@DamonFool
Copy link
Member

@DamonFool Now we have the command reviewers to change the number of the required reviewers. Hope more developers know this.

Nice!
Got it and thanks @lgxbslgx .

/reviewers 2 reviewer

@openjdk
Copy link

openjdk bot commented Dec 15, 2021

@DamonFool Usage: /reviewers <n> [<role>] where <n> is the number of required reviewers. If role is set, the reviewers need to have that project role. If omitted, role defaults to authors.
Number of required reviewers of role reviewers cannot be decreased below 3

@CptGit
Copy link
Contributor Author

CptGit commented Dec 15, 2021

/reviewers 2

@openjdk
Copy link

openjdk bot commented Dec 15, 2021

@CptGit
The number of required reviews for this PR is now set to 2 (with at least 1 of role reviewers).

@openjdk openjdk bot removed sponsor Pull request is ready to be sponsored ready Pull request is ready to be integrated labels Dec 15, 2021
@lgxbslgx
Copy link
Member

@DamonFool Usage: /reviewers [] where is the number of required reviewers. If role is set, the reviewers need to have that project role. If omitted, role defaults to authors.
Number of required reviewers of role reviewers cannot be decreased below 3

@DamonFool Unfortunately, it seems that you meet a bug. I filed SKARA-1288 to follow up.

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.

Before you integrate this, please, add IR framework test which checks that conversions are really happened. Especially ones you removed.

@CptGit
Copy link
Contributor Author

CptGit commented Dec 16, 2021

Before you integrate this, please, add IR framework test which checks that conversions are really happened. Especially ones you removed.

Thanks a lot @vnkozlov for the suggestion of IR test. I added a test and found long type not working. Then I realized "long" did not have two conversions as "int" so I added them. These IR tests helped! Thank you!

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.

Good.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Dec 16, 2021
@CptGit
Copy link
Contributor Author

CptGit commented Dec 16, 2021

/integrate

@openjdk openjdk bot added the sponsor Pull request is ready to be sponsored label Dec 16, 2021
@openjdk
Copy link

openjdk bot commented Dec 16, 2021

@CptGit
Your change (at version 841d404) is now ready to be sponsored by a Committer.

@DamonFool
Copy link
Member

/sponsor

@openjdk
Copy link

openjdk bot commented Dec 16, 2021

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

  • 0dbe4c5: 8278131: runtime/cds/appcds/dynamicArchive/* tests failing in loom repo
  • e6b28e0: Merge
  • d3408a4: 8277964: ClassCastException with no stack trace is thrown with -Xcomp in method handle invocation
  • 69b5d49: 8272064: test/jdk/jdk/jfr/api/consumer/TestHiddenMethod.java needs update for JEP 416
  • d6b5544: 8278607: Misc issues in foreign API javadoc
  • 918e339: 8278233: [macos] tools/jpackage tests timeout due to /usr/bin/osascript
  • f48a3e8: 8278758: runtime/BootstrapMethod/BSMCalledTwice.java fails with release VMs after JDK-8262134
  • 0cc989b: 8278744: KeyStore:getAttributes() not returning unmodifiable Set
  • 475ec8e: 8277919: OldObjectSample event causing bloat in the class constant pool in JFR recording
  • 32139c1: 8262134: compiler/uncommontrap/TestDeoptOOM.java failed with "guarantee(false) failed: wrong number of expression stack elements during deopt"
  • ... and 53 more: https://git.openjdk.java.net/jdk/compare/ec0a5ac8fec75c5c3eda3d9909d2e65d610d9854...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Dec 16, 2021
@openjdk openjdk bot closed this Dec 16, 2021
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review sponsor Pull request is ready to be sponsored labels Dec 16, 2021
@openjdk
Copy link

openjdk bot commented Dec 16, 2021

@DamonFool @CptGit Pushed as commit f6fbb5a.

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

6 participants