Skip to content

Simplify after DCE (Multiple Passes) #422

Open

Description

@boopathi

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};
}

Activity

  1. modified the milestone: 1.0 on Apr 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions