-
Notifications
You must be signed in to change notification settings - Fork 4.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
RyuJIT: missed opportunity for LICM #6666
Comments
(also, FYI @MattWhilden) |
Because of the |
I've verified with opt repeat that phase ordering plays a role here. I had to rewrite the loop conditions using int nest(int stop, int x)
{
int s = 1;
for (int one = 0; one != stop; ++one)
{
for(int two = 0; two != stop; ++two)
{
s += x * x * x;
}
}
return s;
} gets the multiplication hoisted out of both loops with repeat count 2. |
#61420 should address this: |
The following program contains a number of hoistable expressions:
Layout optimization changes the flow graph for
M
to the following:LICM then walks the loops from outer- to innermost and performs the following hoists:
-searchBound
inif (searchBound <= j)
is hoisted out of the outermost loop(i * i * i) + (j * j * j)
is hoisted out of the innermost loopNotably, LICM fails to hoist
(i * i * i)
out of the second loop once it has been placed there by (2).These transformations give the following structure:
Once CSE cleans things up, we end up with:
And the generated assembly, for good measure:
cc @JosephTremoulet
category:cq
theme:loop-opt
skill-level:expert
cost:medium
The text was updated successfully, but these errors were encountered: