-
Notifications
You must be signed in to change notification settings - Fork 167
[CIR][NFC] Add getBreakTarget
method to cir::BreakOp
#1878
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
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.
Eventually we should transfer to multiple-entry, multiple-exit regions, which gives this functionality directly. Though it is unclear when they will be upstreamed.
69801b4
to
7eec012
Compare
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 after pending comment
7eec012
to
2633195
Compare
`cir::BreakOp::getBreakTarget` gets the innermost `cir::LoopOpInterface` or `cir::SwitchOp` containing this `break`. For example: ``` A: for (...) { B: for(...) { break; // target = B C: switch (...) { default: break; // target = C } break; // target = A } ``` NOTE: This is a part of a broader effort I am working on to make querying CIR control flow facts more easily. If folks have any design notes or ideas, please share them. --------- Co-authored-by: Tommy McMichen <[email protected]>
) After #1878, we introduced a dependency from the LoopOpInterface on BreakOp. While here add the BreakOp handling, which will be tests by a pass coming soon. Co-authored-by: Tommy McMichen <[email protected]>
cir::BreakOp::getBreakTarget
gets the innermostcir::LoopOpInterface
orcir::SwitchOp
containing thisbreak
.For example:
NOTE: This is a part of a broader effort I am working on to make querying CIR control flow facts more easily. If folks have any design notes or ideas, please share them.