Skip to content

[mlir][SCF] Allow breaking exit from scf.loop#199741

Draft
matthias-springer wants to merge 1 commit into
users/matthias-springer/scf_loopfrom
users/matthias-springer/early_exit_loop
Draft

[mlir][SCF] Allow breaking exit from scf.loop#199741
matthias-springer wants to merge 1 commit into
users/matthias-springer/scf_loopfrom
users/matthias-springer/early_exit_loop

Conversation

@matthias-springer
Copy link
Copy Markdown
Member

Generalize the MLIR LangRef to allow breaking region exit. A terminator with breaking exit identifies the target operation with a token. All ops on the path from the terminator to the targeted operation must implement the PropagateControlFlowBreak trait.

  • scf.loop and scf.if implement PropagateControlFlowBreak.
  • Generalize scf.if to allow scf.break, scf.continue, scf.yield terminators.
  • Generalize scf.loop verification. A terminator that targets an scf.loop op may now appear deeply nested within the loop body.
  • SCFToControlFlow bails on breaking region exit. A lowering path will be implemented in a follow-up commit.

Partly extracted from: #166688.
Co-authored-by: Mehdi Amini joker.eph@gmail.com
Assisted-by: Opus 4.7

Depends on #199535.

@matthias-springer matthias-springer changed the title [mlir][SCF] Allow early exit from scf.loop [mlir][SCF] Allow breaking exit from scf.loop May 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant