-
Notifications
You must be signed in to change notification settings - Fork 6.1k
8366815: C2: Delay Mod/Div by constant transformation #27886
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
base: master
Are you sure you want to change the base?
Conversation
👋 Welcome back hgreule! A progress list of the required criteria for merging this PR into |
❗ This change is not yet ready to be integrated. |
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.
Thank you for working on this, @SirYwell. This seems like a tricky problem. To be honest, the fix seems a bit hacky. Have you explored any alternatives to this method of delaying the optimizations?
I kicked off some testing in the meantime that I will report back upon completion.
// Keep this node as-is for now; we want Value() and | ||
// other optimizations checking for this node type to work |
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.
// Keep this node as-is for now; we want Value() and | |
// other optimizations checking for this node type to work | |
// Keep this node as-is initially; we want Value() and | |
// other optimizations checking for this node type to work. |
This is a small nit: I find it confusing to talk about "for now" in a method that is called at almost every stage of the compilation. Perhaps "initially" conveys the intention of first letting other optimizations do their magic first a bit better.
Thanks for running tests. I tried delaying until post loop opts, but that prevents some vectorization and isn't really less hacky I guess. I didn't find any other good existing approach. Calculating Value before Ideal would work, but I assume that it is rarely useful, with Div/Mod being an exception. I a dream world, I guess we would have e-graphs or something similar, which would allow calculating a more precise type from different alternatives. If you can think of a better approach, please let me know. |
The test cases show examples of code where
Value()
previously wasn't run because idealization took place before, resulting in less precise type analysis.Please let me know what you think.
Progress
Issue
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/27886/head:pull/27886
$ git checkout pull/27886
Update a local copy of the PR:
$ git checkout pull/27886
$ git pull https://git.openjdk.org/jdk.git pull/27886/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 27886
View PR using the GUI difftool:
$ git pr show -t 27886
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/27886.diff
Using Webrev
Link to Webrev Comment