Skip to content

Make "scoped" regions somehow explicit #335

Open
@bcardosolopes

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:

  1. Add an extra class member to every CIR_Op, something like regionsHaveScopeLikeBehavior(). Have that be false by default and turn that true for ops that embed the semantics.
  2. 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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions