Skip to content
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

Simplify after DCE (Multiple Passes) #422

Open
boopathi opened this issue Feb 12, 2017 · 0 comments
Open

Simplify after DCE (Multiple Passes) #422

boopathi opened this issue Feb 12, 2017 · 0 comments
Milestone

Comments

@boopathi
Copy link
Member

boopathi commented Feb 12, 2017

Related #61 , #317

Right now DCE is run in a single pass at the Program.exit. But this blocks other optimisations that could be performed after DCE - such as simplify.

an example - from #420 ... if_return optimisation (simplify) after DCE is not happening here because DCE is at the end, and requires a second pass.

Also, if the function is an arrow function, after DCE, an arrow function with a single return statement could be further simplified to remove the BlockStatement, which is also not happening now because of the same reasons.

// input
function foo(...args) {
  if (!i) return;
  else {
    const x = {args};
    while(false);
    return x;
  }
};

// out
function foo(...a) {
  if (!i) return;
  return { args: a };
}

// could reduce to
function foo(...a) {
  if (i) return {args: a};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant