Open
Description
> My main issue with this conditional is that it omits the `cir.scope` op in certain scenarios. A `cir.if`, for example, will not have an explicitly defined `cir.scope` operation in its regions.
This is by design, it's not an early optimization - see how the lifetime checker deals with if regions. Whether we should keep it looking into the future, it's another story, another PR. The initial idea is that it was redundant to add a scope op that basically wraps all of the region, so the regions for a if (and some other ops) imply scope like behavior. I agree how it could be confusing though (you just seemed to be caught here too) and I just noticed I didn't document that behavior. Alternatives approach could be:
- Add an extra class member to every
CIR_Op
, something likeregionsHaveScopeLikeBehavior()
. Have that befalse
by default and turn that true for ops that embed the semantics. - Explicitly add a scope to every region that makes sense, I kinda dislike the verbosity though:
cir.if(...) {
cir.scope {
...
}
} else ...
If you wanna document the implying scope behavior, please add those FIXME's where it's more clear what you want to do in the future.
Originally posted by @bcardosolopes in #313 (comment)
Metadata
Assignees
Labels
No labels