-
-
Notifications
You must be signed in to change notification settings - Fork 225
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
Perform SSA -type of optimizations #313
Comments
So, I'm thinking to implement something like this -
thoughts or suggestions ? |
The way I see it is we're dealing with 2 things here — duplicate declarations (aka K violations) and partial evaluation (where we can statically resolve It might be simpler to break it in these 2 steps. @boopathi can you explain your "decl -> reference -> K violation -> ref -> K violation -> ref" chain? why does reference would link back to K violation? How would it look in the above example? I'm trying to understand. |
That's the flow graph ... Right now, we don't have the control flow for something that we calculate based on positions and other clues ... So, for this example - var a = 1;
foo(a);
a = 2;
bar(a);
var a = a + 3;
baz(a); We need to rename the references correctly to the corresponding declarations (when replaced). So the flow for
var a = 1;
foo(a);
var a2 = 2;
bar(a2); // a needs to be updated to a2 and a2's references should point here
var a3 = a2 + 3;
baz(a3); And we deal with branching and looping accordingly. |
(as @hzoo suggested in Slack)
c.f.: https://en.wikipedia.org/wiki/Static_single_assignment_form
We can determine that 1st statement is useless. Combined with variable inlining, we could shorten this to the ideal
y = 2
.The text was updated successfully, but these errors were encountered: