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

[Opt] [refactor] Move unreachable code elimination to a separate pass #1315

Merged
merged 6 commits into from
Jun 24, 2020

Conversation

xumingkuan
Copy link
Contributor

@xumingkuan xumingkuan commented Jun 23, 2020

Related issue = #656
Related PR = #1299

I did this refactoring because the optimization about ContinueStmt in simplify I added in #1299 probably made removing the exceptions (#1059) in that pass more difficult.

Although the function of this pass is similar to the DIE pass, the logic is completely different. So I put it in a separate pass. We can eliminate ContinueStmts like the following in this PR:

$1 = for ... {
  $2 = ...
  $3 : if ... {
    $4 = continue
  }
}

I'm not sure about how this pass should be named, so feel free to propose better names.

benchmark20200623_2

[Click here for the format server]


@xumingkuan xumingkuan changed the title [Opt] [refactor] Move unreachable code elimination to a separate pass [opt] [refactor] Move unreachable code elimination to a separate pass Jun 23, 2020
@xumingkuan xumingkuan requested a review from yuanming-hu June 23, 2020 23:31
@xumingkuan
Copy link
Contributor Author

BTW Shall we add optimizations for if (0) and if (1)?

@codecov
Copy link

codecov bot commented Jun 24, 2020

Codecov Report

Merging #1315 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1315   +/-   ##
=======================================
  Coverage   86.14%   86.14%           
=======================================
  Files          18       18           
  Lines        3313     3313           
  Branches      622      622           
=======================================
  Hits         2854     2854           
  Misses        333      333           
  Partials      126      126           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5ca95e4...06f9cfd. Read the comment docs.

Copy link
Member

@yuanming-hu yuanming-hu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks!

BTW Shall we add optimizations for if (0) and if (1)?

Sounds good!

taichi/transforms/continue_stmt_optimization.cpp Outdated Show resolved Hide resolved
Co-authored-by: Yuanming Hu <yuanming-hu@users.noreply.github.com>
@xumingkuan
Copy link
Contributor Author

BTW Shall we add optimizations for if (0) and if (1)?

So I think I should add the optimization into this pass, and rename the pass unreachable_code_elimination?

@xumingkuan xumingkuan changed the title [opt] [refactor] Move unreachable code elimination to a separate pass [Opt] [refactor] Move unreachable code elimination to a separate pass Jun 24, 2020
@xumingkuan xumingkuan requested a review from yuanming-hu June 24, 2020 02:10
Copy link
Member

@yuanming-hu yuanming-hu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks!

@xumingkuan xumingkuan merged commit 384dfbe into taichi-dev:master Jun 24, 2020
xumingkuan added a commit to xumingkuan/taichi that referenced this pull request Jun 24, 2020
@FantasyVR FantasyVR mentioned this pull request Jun 24, 2020
Rullec pushed a commit to Rullec/taichi that referenced this pull request Jun 26, 2020
…taichi-dev#1315)

* [Opt] [refactor] Move unreachable code elimination to a separate pass

* improve

* minor

* [skip ci] minor

* Update taichi/transforms/continue_stmt_optimization.cpp

Co-authored-by: Yuanming Hu <yuanming-hu@users.noreply.github.com>

* add optimizations for if (0) and if (1)

Co-authored-by: Yuanming Hu <yuanming-hu@users.noreply.github.com>
Rullec pushed a commit to Rullec/taichi that referenced this pull request Jun 26, 2020
@xumingkuan xumingkuan deleted the continue2 branch June 28, 2020 22:51
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

Successfully merging this pull request may close these issues.

2 participants