-
Notifications
You must be signed in to change notification settings - Fork 6.2k
8327381: Refactor type-improving transformations in BoolNode::Ideal to BoolNode::Value #18198
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 kxu! A progress list of the required criteria for merging this PR into |
Webrevs
|
also excluding negative values for unsigned comparison
jaskarth
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 think the cleanup looks good! I have mostly stylistic suggestions here. Also, the copyright header in subnode.cpp should be updated to read 2024.
eme64
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 like a reasonable idea. Running tests now. Will review afterwards.
jaskarth
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.
Thanks for the update! Just one more thing from me.
|
Oops. Package name updated. Sorry for such a rookie mistake! |
jaskarth
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.
No worries, looks good to me now :)
|
@tabjy 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 28 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. 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 (@jaskarth, @eme64, @chhagedorn, @TobiHartmann) but any other Committer may sponsor as well. ➡️ To flag this PR as ready for integration with the above commit message, type |
|
Edit: Yep, filed JDK-8328315. |
|
Ah, I had assumed the transformation was valid beforehand, since it had existed for a while 😅 The issue only impacts The original patch seems to primarily test with -} else if (_test._test == BoolTest::lt && cmp2->Opcode() == Op_AddI && cmp2->in(2)->find_int_con(0) == 1) {
+} else if (_test._test == BoolTest::lt && cmp2->Opcode() == Op_AddI && cmp2->in(2)->find_int_con(0) == 1 && phase->type(cmp2->in(1))->is_int()->_lo >= 0) {With the IR test being modified accordingly. It'd also be good to write an IR test method that verifies that the transform doesn't take place if |
|
@jaskarth Optimally, |
|
@tabjy I am re-running testing, then will re-review. |
eme64
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.
The cpp code looks good, I have some small issues with the test. But we are close ;)
|
I pushed a commit to spread test cases compounded with A case illustrating @Test
@Arguments(values = {Argument.DEFAULT, Argument.DEFAULT})
@IR(counts = {IRNode.CMP_U, "1"}, // <-- expecting strictly 1
phase = CompilePhase.AFTER_PARSING,
applyIfPlatformOr = {"x64", "true", "aarch64", "true", "riscv64", "true"})
public static boolean testShouldHaveCpmUCase1(int x, int m) {
return !(Integer.compareUnsigned((x & m), m - 1) > 0);
} |
|
Thanks @tabjy! @chhagedorn, our IR Framework expert, is currently on vacation but will be back later this week. |
|
@chhagedorn should we change the regex to have a space at the end, so that we do not do this kind of prefix-matching? |
I think that would be a better solution to change the regex. Then we can change the test in such a way that it does an exact counting. Maybe we should move through all the We already do that, for example, to match jdk/test/hotspot/jtreg/compiler/lib/ir_framework/IRNode.java Lines 495 to 499 in 05d88de
We could do something similar for |
|
@tabjy Are you planning to keep working on this? In a later and separate RFE, we can then adjust the regex for all nodes, in a bulk update. |
Good idea, I filed JDK-8338809 to follow up on this after this PR gets integrated. But for now, I suggest to use an explicit regex as suggested above with |
|
I sincerely apologize for not following up on this timely. This won't happen again.
First, I assume you mean Unfortunately this does not work. jdk/test/hotspot/jtreg/compiler/lib/ir_framework/IRNode.java Lines 440 to 443 in a15af69
Even if we explicitly make it I think it's the second argument to public static final String CMP_U = PREFIX + "CMP_U" + POSTFIX;
static {
- beforeMatchingNameRegex(CMP_U, "CmpU");
+ beforeMatchingNameRegex(CMP_U, "CmpU\\b");
} The three existing tests currently referencing I'm going to push a commit to do so. If you think it's not appropriate to change |
|
Hi @tabjy, no worries! You're right, you cannot just append the |
|
@chhagedorn It's already pushed. The HEAD has the up to date master merged in. Please let me know how the test goes. Thanks! |
|
Right, missed that. Testing is submitted, I report back once it's complete |
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.
Testing looked good!
TobiHartmann
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.
That looks good to me. @eme64 is currently out but you can integrate this now.
|
/integrate |
|
/sponsor |
|
Going to push as commit 1383fec.
Your commit was automatically rebased without conflicts. |
|
@TobiHartmann @tabjy Pushed as commit 1383fec. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
This PR resolves JDK-8327381
Currently the transformations for expressions with patterns
((x & m) u<= m)or((m & x) u<= m)totrueis inBoolNode::Idealfunction with a new constant node of value1created. However, this is technically a type-improving (reduction in range) transformation that's better suited inBoolNode::Valuefunction.New unit test
test/hotspot/jtreg/compiler/c2/TestBoolNodeGvn.javaasserting on IR nodes and correctness of this transformation is added and passing.Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/18198/head:pull/18198$ git checkout pull/18198Update a local copy of the PR:
$ git checkout pull/18198$ git pull https://git.openjdk.org/jdk.git pull/18198/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 18198View PR using the GUI difftool:
$ git pr show -t 18198Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/18198.diff
Webrev
Link to Webrev Comment