-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
[Bug] [opt] Fix compilation crash when there is a container statement after an unconditional continue #1299
Conversation
… after an unconditional continue
location = (int)statements.size() - 1; | ||
location = (int)statements.size(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(I wonder why this has been in the codebase for 5 months...)
So actually it should be
if a:
continue
if a:
if a:
continue
instead of
if a:
if a:
continue
if a:
continue
which causes ControlFlowGraph::unreachable_code_elimination
to produce malformed IR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for fixing this! It's surprising that we have this issue for so long time without noticing...
Codecov Report
@@ Coverage Diff @@
## master #1299 +/- ##
=======================================
Coverage 85.59% 85.59%
=======================================
Files 18 18
Lines 3283 3283
Branches 621 621
=======================================
Hits 2810 2810
Misses 345 345
Partials 128 128 Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you so much!
location = (int)statements.size() - 1; | ||
location = (int)statements.size(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for fixing this! It's surprising that we have this issue for so long time without noticing...
… after an unconditional continue (taichi-dev#1299) * [Bug] [opt] Fix compilation crash when there is a container statement after an unconditional continue * [skip ci] enforce code format * retrigger CI * retrigger CI Co-authored-by: Taichi Gardener <[email protected]>
Related issue = fix #1297
I moved the unreachable code elimination pass from
cfg_optimization
tosimplify
because the former can't eliminate container statements properly. I tried writing something likestd::vector<Stmt *> not_in_any_nodes
in the CFG, but it's hard to know whether aContinueStmt
can be eliminated in the CFG, so anIfStmt
with only oneContinueStmt
in it can't be eliminated easily too.[Click here for the format server]