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

Pierced bundler: run DCE to a fixpoint #60

Open
bakkot opened this issue Apr 2, 2019 · 0 comments
Open

Pierced bundler: run DCE to a fixpoint #60

bakkot opened this issue Apr 2, 2019 · 0 comments

Comments

@bakkot
Copy link
Member

bakkot commented Apr 2, 2019

Consider the following program:

function a() {}
function b() { return a(); }
var c = 0;
var d = 1;
export { d };

If you run bandolier with that as the entrypoint, with default options, you get (an unformatted version of)

(function(w) {
  'use strict';
  function a() {}
  var d = 1;
  var e = { __proto__: null, d: d };
  if (w.Symbol)
    w.Object.defineProperty(e, w.Symbol.toStringTag, { value: 'Module' });
  e = w.Object.freeze(e);
  return e;
})(this);

As you'd expect, b and c are eliminated. But a is not. This is presumably because it's only dead after b has been eliminated.

I think dead code elimination should be run to a fixpoint, so that a is removed as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant