[all-commits] [llvm/llvm-project] 72435d: [CIR] Add structured control flow for coroutine su...

Andres-Salamanca via All-commits all-commits at lists.llvm.org
Thu Oct 1 15:59:46 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 72435d3cf2e601d53595715b42246b02d65f0966
      https://github.com/llvm/llvm-project/commit/72435d3cf2e601d53595715b42246b02d65f0966
  Author: Andres-Salamanca <andrealebarbaritos at gmail.com>
  Date:   2026-10-01 (Thu, 01 Oct 2026)

  Changed paths:
    M clang/include/clang/CIR/Dialect/IR/CIROps.td
    M clang/lib/CIR/CodeGen/CIRGenCoroutine.cpp
    M clang/lib/CIR/Dialect/IR/CIRDialect.cpp
    M clang/test/CIR/CodeGenCoroutines/Inputs/coroutine.h
    M clang/test/CIR/CodeGenCoroutines/coro-exceptions.cpp
    M clang/test/CIR/CodeGenCoroutines/coro-task.cpp
    M clang/test/CIR/IR/await.cir
    M clang/test/CIR/IR/co-return.cir
    R clang/test/CIR/IR/coro-body.cir
    A clang/test/CIR/IR/coroutine.cir
    M clang/test/CIR/IR/func.cir
    M clang/test/CIR/IR/invalid-await.cir
    M clang/test/CIR/IR/invalid-co-return.cir
    R clang/test/CIR/IR/invalid-coro-body.cir
    A clang/test/CIR/IR/invalid-coroutine.cir
    M clang/unittests/CIR/ControlFlowTest.cpp

  Log Message:
  -----------
  [CIR] Add structured control flow for coroutine suspend points (#213191)

This PR adds 2 new ops for improving structured control flow in
coroutines, according to the redesign in this discussion:
https://github.com/llvm/llvm-project/pull/203802#discussion_r3464356343

One of the ops is `suspend_point`, which marks the point where a
coroutine should suspend and return control flow to the caller it's also
the point where the coroutine resumes from when it starts again. This op
must be inside the `cir.await` suspend region, and it works in pair with
the `CoroRetPoint` op, which marks the only exit point of the coroutine
so no matter how many awaits/suspend points exist in the body, they all
converge on the same exit path.
This will help the FlattenCFG pass know where to branch when flattening
the `cir.await` op. Previously we didn't have an exact point to branch
to when suspending a coroutine this gives us that.

---------

Co-authored-by: Erich Keane <ekeane at nvidia.com>



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list