You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a for, while, or do/while loop contains a break or continue statement at the top level of the loop's body, and the break or continue statement is not the last statement in the block, then ClangIR fails validation.
void test(int x) {
for (int i = 0; i < x; ++i) {
break;
--x;
}
}
loc("for-break.cpp":3:5): error: 'cir.yield' op must be the last operation in the parent block
fatal error: error in backend: CIR codegen: module verification error before running CIR passes
If the break or continue is in a nested scope within the loop (which is the normal case in real code), there is no error. If the break or continue statement is the last statement in the block then there is a different internal error which is covered by #324.
The text was updated successfully, but these errors were encountered:
Handling unreachable code is lacking some support here indeed. We should probably end the first basic block with cir.yield break, and start a new bb to stuff --x, which should end with a regular cir.yield.
Without this patch, CIR CodeGen continue to generate in the same block
after `cir.break` and `cir.continue`, which would cause verification
error because `cir.break` and `cir.continue` should appear at the end of
blocks.
This patch creates a new dangling block after generating `cir.break` and
`cir.continue` to fix the issue.
This will fix#323.
When a
for
,while
, ordo
/while
loop contains abreak
orcontinue
statement at the top level of the loop's body, and thebreak
orcontinue
statement is not the last statement in the block, then ClangIR fails validation.If the
break
orcontinue
is in a nested scope within the loop (which is the normal case in real code), there is no error. If thebreak
orcontinue
statement is the last statement in the block then there is a different internal error which is covered by #324.The text was updated successfully, but these errors were encountered: