-
Notifications
You must be signed in to change notification settings - Fork 100
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
[CIR][Lowering] Fixed break/continue lowering for loops #211
Conversation
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.
This is pretty cool, thanks for fixing this issue! Added a few comments inline.
@sitio-couto can you also take a look?
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.
@gitoleg great implementation! Thanks.
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.
@gitoleg great! Thanks.
@gitoleg could you squash the commits in this PR and rebase it on main so that we can land it? |
@sitio-couto can you try "Squash and merge"? Should do the job! |
This PR fixes lowering for `break/continue` in loops. The idea is to replace `cir.yield break` and `cir.yield continue` with the branch operations to the corresponding blocks. Note, that we need to ignore nesting loops and don't touch `break` in switch operations. Also, `yield` from `if` need to be considered only when it's not the loop `yield` and `continue` in switch is ignored since it's processed in the loops lowering. Fixes #160
This PR fixes a couple of corner cases connected with the `YieldOp` lowering in loops. Previously, in #211 we introduced `lowerNestedBreakContinue` but we didn't check that `YieldOp` may belong to the same region, i.e. it is not nested, e.g. ``` while(1) { break; } ``` Hence the error `op already replaced`. Next, we fix `yield` lowering for `ifOp` and `switchOp` but didn't cover `scopeOp`, and the same error occurred. This PR fixes this as well. I added two tests - with no checks actually, just to make sure no more crashes happen. fixes #324
This PR fixes lowering for `break/continue` in loops. The idea is to replace `cir.yield break` and `cir.yield continue` with the branch operations to the corresponding blocks. Note, that we need to ignore nesting loops and don't touch `break` in switch operations. Also, `yield` from `if` need to be considered only when it's not the loop `yield` and `continue` in switch is ignored since it's processed in the loops lowering. Fixes #160
This PR fixes a couple of corner cases connected with the `YieldOp` lowering in loops. Previously, in #211 we introduced `lowerNestedBreakContinue` but we didn't check that `YieldOp` may belong to the same region, i.e. it is not nested, e.g. ``` while(1) { break; } ``` Hence the error `op already replaced`. Next, we fix `yield` lowering for `ifOp` and `switchOp` but didn't cover `scopeOp`, and the same error occurred. This PR fixes this as well. I added two tests - with no checks actually, just to make sure no more crashes happen. fixes #324
This PR fixes lowering for `break/continue` in loops. The idea is to replace `cir.yield break` and `cir.yield continue` with the branch operations to the corresponding blocks. Note, that we need to ignore nesting loops and don't touch `break` in switch operations. Also, `yield` from `if` need to be considered only when it's not the loop `yield` and `continue` in switch is ignored since it's processed in the loops lowering. Fixes #160
This PR fixes a couple of corner cases connected with the `YieldOp` lowering in loops. Previously, in #211 we introduced `lowerNestedBreakContinue` but we didn't check that `YieldOp` may belong to the same region, i.e. it is not nested, e.g. ``` while(1) { break; } ``` Hence the error `op already replaced`. Next, we fix `yield` lowering for `ifOp` and `switchOp` but didn't cover `scopeOp`, and the same error occurred. This PR fixes this as well. I added two tests - with no checks actually, just to make sure no more crashes happen. fixes #324
This PR fixes lowering for `break/continue` in loops. The idea is to replace `cir.yield break` and `cir.yield continue` with the branch operations to the corresponding blocks. Note, that we need to ignore nesting loops and don't touch `break` in switch operations. Also, `yield` from `if` need to be considered only when it's not the loop `yield` and `continue` in switch is ignored since it's processed in the loops lowering. Fixes #160
This PR fixes a couple of corner cases connected with the `YieldOp` lowering in loops. Previously, in #211 we introduced `lowerNestedBreakContinue` but we didn't check that `YieldOp` may belong to the same region, i.e. it is not nested, e.g. ``` while(1) { break; } ``` Hence the error `op already replaced`. Next, we fix `yield` lowering for `ifOp` and `switchOp` but didn't cover `scopeOp`, and the same error occurred. This PR fixes this as well. I added two tests - with no checks actually, just to make sure no more crashes happen. fixes #324
This PR fixes lowering for `break/continue` in loops. The idea is to replace `cir.yield break` and `cir.yield continue` with the branch operations to the corresponding blocks. Note, that we need to ignore nesting loops and don't touch `break` in switch operations. Also, `yield` from `if` need to be considered only when it's not the loop `yield` and `continue` in switch is ignored since it's processed in the loops lowering. Fixes llvm#160
) This PR fixes a couple of corner cases connected with the `YieldOp` lowering in loops. Previously, in llvm#211 we introduced `lowerNestedBreakContinue` but we didn't check that `YieldOp` may belong to the same region, i.e. it is not nested, e.g. ``` while(1) { break; } ``` Hence the error `op already replaced`. Next, we fix `yield` lowering for `ifOp` and `switchOp` but didn't cover `scopeOp`, and the same error occurred. This PR fixes this as well. I added two tests - with no checks actually, just to make sure no more crashes happen. fixes llvm#324
This PR fixes lowering for `break/continue` in loops. The idea is to replace `cir.yield break` and `cir.yield continue` with the branch operations to the corresponding blocks. Note, that we need to ignore nesting loops and don't touch `break` in switch operations. Also, `yield` from `if` need to be considered only when it's not the loop `yield` and `continue` in switch is ignored since it's processed in the loops lowering. Fixes llvm#160
) This PR fixes a couple of corner cases connected with the `YieldOp` lowering in loops. Previously, in llvm#211 we introduced `lowerNestedBreakContinue` but we didn't check that `YieldOp` may belong to the same region, i.e. it is not nested, e.g. ``` while(1) { break; } ``` Hence the error `op already replaced`. Next, we fix `yield` lowering for `ifOp` and `switchOp` but didn't cover `scopeOp`, and the same error occurred. This PR fixes this as well. I added two tests - with no checks actually, just to make sure no more crashes happen. fixes llvm#324
This PR fixes lowering for `break/continue` in loops. The idea is to replace `cir.yield break` and `cir.yield continue` with the branch operations to the corresponding blocks. Note, that we need to ignore nesting loops and don't touch `break` in switch operations. Also, `yield` from `if` need to be considered only when it's not the loop `yield` and `continue` in switch is ignored since it's processed in the loops lowering. Fixes #160
This PR fixes a couple of corner cases connected with the `YieldOp` lowering in loops. Previously, in #211 we introduced `lowerNestedBreakContinue` but we didn't check that `YieldOp` may belong to the same region, i.e. it is not nested, e.g. ``` while(1) { break; } ``` Hence the error `op already replaced`. Next, we fix `yield` lowering for `ifOp` and `switchOp` but didn't cover `scopeOp`, and the same error occurred. This PR fixes this as well. I added two tests - with no checks actually, just to make sure no more crashes happen. fixes #324
This PR fixes lowering for `break/continue` in loops. The idea is to replace `cir.yield break` and `cir.yield continue` with the branch operations to the corresponding blocks. Note, that we need to ignore nesting loops and don't touch `break` in switch operations. Also, `yield` from `if` need to be considered only when it's not the loop `yield` and `continue` in switch is ignored since it's processed in the loops lowering. Fixes #160
This PR fixes a couple of corner cases connected with the `YieldOp` lowering in loops. Previously, in #211 we introduced `lowerNestedBreakContinue` but we didn't check that `YieldOp` may belong to the same region, i.e. it is not nested, e.g. ``` while(1) { break; } ``` Hence the error `op already replaced`. Next, we fix `yield` lowering for `ifOp` and `switchOp` but didn't cover `scopeOp`, and the same error occurred. This PR fixes this as well. I added two tests - with no checks actually, just to make sure no more crashes happen. fixes #324
This PR fixes lowering for `break/continue` in loops. The idea is to replace `cir.yield break` and `cir.yield continue` with the branch operations to the corresponding blocks. Note, that we need to ignore nesting loops and don't touch `break` in switch operations. Also, `yield` from `if` need to be considered only when it's not the loop `yield` and `continue` in switch is ignored since it's processed in the loops lowering. Fixes llvm#160
) This PR fixes a couple of corner cases connected with the `YieldOp` lowering in loops. Previously, in llvm#211 we introduced `lowerNestedBreakContinue` but we didn't check that `YieldOp` may belong to the same region, i.e. it is not nested, e.g. ``` while(1) { break; } ``` Hence the error `op already replaced`. Next, we fix `yield` lowering for `ifOp` and `switchOp` but didn't cover `scopeOp`, and the same error occurred. This PR fixes this as well. I added two tests - with no checks actually, just to make sure no more crashes happen. fixes llvm#324
This PR fixes lowering for `break/continue` in loops. The idea is to replace `cir.yield break` and `cir.yield continue` with the branch operations to the corresponding blocks. Note, that we need to ignore nesting loops and don't touch `break` in switch operations. Also, `yield` from `if` need to be considered only when it's not the loop `yield` and `continue` in switch is ignored since it's processed in the loops lowering. Fixes #160
This PR fixes a couple of corner cases connected with the `YieldOp` lowering in loops. Previously, in #211 we introduced `lowerNestedBreakContinue` but we didn't check that `YieldOp` may belong to the same region, i.e. it is not nested, e.g. ``` while(1) { break; } ``` Hence the error `op already replaced`. Next, we fix `yield` lowering for `ifOp` and `switchOp` but didn't cover `scopeOp`, and the same error occurred. This PR fixes this as well. I added two tests - with no checks actually, just to make sure no more crashes happen. fixes #324
This PR fixes lowering for `break/continue` in loops. The idea is to replace `cir.yield break` and `cir.yield continue` with the branch operations to the corresponding blocks. Note, that we need to ignore nesting loops and don't touch `break` in switch operations. Also, `yield` from `if` need to be considered only when it's not the loop `yield` and `continue` in switch is ignored since it's processed in the loops lowering. Fixes llvm#160
) This PR fixes a couple of corner cases connected with the `YieldOp` lowering in loops. Previously, in llvm#211 we introduced `lowerNestedBreakContinue` but we didn't check that `YieldOp` may belong to the same region, i.e. it is not nested, e.g. ``` while(1) { break; } ``` Hence the error `op already replaced`. Next, we fix `yield` lowering for `ifOp` and `switchOp` but didn't cover `scopeOp`, and the same error occurred. This PR fixes this as well. I added two tests - with no checks actually, just to make sure no more crashes happen. fixes llvm#324
This PR fixes lowering for `break/continue` in loops. The idea is to replace `cir.yield break` and `cir.yield continue` with the branch operations to the corresponding blocks. Note, that we need to ignore nesting loops and don't touch `break` in switch operations. Also, `yield` from `if` need to be considered only when it's not the loop `yield` and `continue` in switch is ignored since it's processed in the loops lowering. Fixes llvm#160
) This PR fixes a couple of corner cases connected with the `YieldOp` lowering in loops. Previously, in llvm#211 we introduced `lowerNestedBreakContinue` but we didn't check that `YieldOp` may belong to the same region, i.e. it is not nested, e.g. ``` while(1) { break; } ``` Hence the error `op already replaced`. Next, we fix `yield` lowering for `ifOp` and `switchOp` but didn't cover `scopeOp`, and the same error occurred. This PR fixes this as well. I added two tests - with no checks actually, just to make sure no more crashes happen. fixes llvm#324
This PR fixes lowering for `break/continue` in loops. The idea is to replace `cir.yield break` and `cir.yield continue` with the branch operations to the corresponding blocks. Note, that we need to ignore nesting loops and don't touch `break` in switch operations. Also, `yield` from `if` need to be considered only when it's not the loop `yield` and `continue` in switch is ignored since it's processed in the loops lowering. Fixes llvm#160
) This PR fixes a couple of corner cases connected with the `YieldOp` lowering in loops. Previously, in llvm#211 we introduced `lowerNestedBreakContinue` but we didn't check that `YieldOp` may belong to the same region, i.e. it is not nested, e.g. ``` while(1) { break; } ``` Hence the error `op already replaced`. Next, we fix `yield` lowering for `ifOp` and `switchOp` but didn't cover `scopeOp`, and the same error occurred. This PR fixes this as well. I added two tests - with no checks actually, just to make sure no more crashes happen. fixes llvm#324
This PR fixes lowering for `break/continue` in loops. The idea is to replace `cir.yield break` and `cir.yield continue` with the branch operations to the corresponding blocks. Note, that we need to ignore nesting loops and don't touch `break` in switch operations. Also, `yield` from `if` need to be considered only when it's not the loop `yield` and `continue` in switch is ignored since it's processed in the loops lowering. Fixes #160
This PR fixes a couple of corner cases connected with the `YieldOp` lowering in loops. Previously, in #211 we introduced `lowerNestedBreakContinue` but we didn't check that `YieldOp` may belong to the same region, i.e. it is not nested, e.g. ``` while(1) { break; } ``` Hence the error `op already replaced`. Next, we fix `yield` lowering for `ifOp` and `switchOp` but didn't cover `scopeOp`, and the same error occurred. This PR fixes this as well. I added two tests - with no checks actually, just to make sure no more crashes happen. fixes #324
This PR fixes lowering for
break/continue
in loops.The idea is to replace
cir.yield break
andcir.yield continue
with the branch operations to the corresponding blocks. Note, that we need to ignore nesting loops and don't touchbreak
in switch operations. Also,yield
fromif
need to be considered only when it's not the loopyield
andcontinue
in switch is ignored since it's processed in the loops lowering.Fixes #160