-
Notifications
You must be signed in to change notification settings - Fork 211
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
Flattening pass does not handle branches where the merge block is in the then
branch.
#6620
Comments
then
branch.
The real problem with the above is that because the merge block is the same as the then block, we try and add the new blocks [b2, b1, b2] to the work queue, however due to deduplication we instead get [b2, b1]. This means that when we take then next block off of the work queue we pick up the else block and treat it as if it were the then block. We apply the incorrect condition within this block which causes the store to be predicated incorrectly. |
Consider the programs
and
These are entirely equivalent as the only difference is in the second we have inlined
b3
intob2
. However when we flatten these programs we end up with the resultsWe must be doing something incorrectly caused by how we're looking for the point at which these two branches merge again. One thing to note is that
b2
is thethen
branch for this if-else branch so we end up in a situation where we're inlining the merge block before we've inlined both of the branching blocks:noir/compiler/noirc_evaluator/src/ssa/opt/flatten_cfg.rs
Line 422 in 7d61242
The text was updated successfully, but these errors were encountered: