Skip to content

Simplify after DCE requires second pass #317

Closed

Description

@boopathi
function foo() {
  const a = 5;
  return a + 5;
}

output:

function foo() {
  return 5 + 5;
}

Deadcode elimination is now run last, so we don't have anything after DCE. It requires a second pass to optimize this further.

Activity

  1. kangax commented on Dec 5, 2016

    @kangax
    Member

    I'm guessing we can't just swap them, right? One option could be to just run simplify again after DCE, but then we miss out on other combinations, which brings us back to #61. Should we just keep track of it there?

  2. boopathi commented on Dec 5, 2016

    @boopathi
    MemberAuthor

    Yeah. DCE runs on Program.exit. So order of simplify and DCE doesn't matter.

    Do we have to identify the combinations (cases like this one) or would it regress if we blindly run the transformations twice (with an option) ?

    Cool. Will keep track of the related issues in #61.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions