close
The Wayback Machine - https://web.archive.org/web/20201004025354/https://github.com/google-research/dex-lang/pull/221
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

Improve DCE and inliner #221

Merged
merged 2 commits into from Sep 3, 2020
Merged

Improve DCE and inliner #221

merged 2 commits into from Sep 3, 2020

Conversation

@apaszke
Copy link
Collaborator

@apaszke apaszke commented Sep 3, 2020

Track liveness more accurately in DCE

The previous implementation would fail to optimize many case
expressions, because the liveness information from one branch would get
propagated into the other branch. Also, names of top-level decls used in
module binders are allowed to appear in those sub-blocks, which has
invalidated some more optimization opportunities.

Make the inliner use aggregation more accurate

The previous approach was quite eager to overestimate the number of uses
of each binder, because we tend to aggressively reuse names in
incomparable scopes. This patch adds an extra slot in each binder, which
can be filled in with inlining hints. The whole procedure is very
similar to DCE and the approach is heavily inspired by the "Secrets of
the GHC inliner" paper.

The previous implementation would fail to optimize many case
expressions, because the liveness information from one branch would get
propagated into the other branch. Also, names of top-level decls used in
module binders are allowed to appear in those sub-blocks, which has
invalidated some more optimization opportunities.
@googlebot googlebot added the cla: yes label Sep 3, 2020
The previous approach was quite eager to overestimate the number of uses
of each binder, because we tend to aggressively reuse names in
incomparable scopes. This patch adds an extra slot in each binder, which
can be filled in with inlining hints. The whole procedure is very
similar to DCE and the approach is heavily inspired by the "Secrets of
the GHC inliner" paper.
@apaszke apaszke force-pushed the apaszke:optimize-core branch from 01acf01 to d63f6c7 Sep 3, 2020
@apaszke apaszke merged commit 5d38784 into google-research:main Sep 3, 2020
2 checks passed
2 checks passed
cla/google All necessary CLAs are signed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@apaszke apaszke deleted the apaszke:optimize-core branch Sep 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.