[all-commits] [llvm/llvm-project] 164689: [mlir][async] Lazily create the coroutine destroy-...

Matthias Springer via All-commits all-commits at lists.llvm.org
Mon May 25 17:20:01 PDT 2026


  Branch: refs/heads/users/matthias-springer/async_dead_code
  Home:   https://github.com/llvm/llvm-project
  Commit: 16468984036db122c28a5ad843c36cafdd0d3a90
      https://github.com/llvm/llvm-project/commit/16468984036db122c28a5ad843c36cafdd0d3a90
  Author: Matthias Springer <me at m-sp.org>
  Date:   2026-05-26 (Tue, 26 May 2026)

  Changed paths:
    M mlir/lib/Dialect/Async/Transforms/AsyncToAsyncRuntime.cpp
    M mlir/test/Dialect/Async/async-to-async-runtime.mlir

  Log Message:
  -----------
  [mlir][async] Lazily create the coroutine destroy-cleanup block

`setupCoroMachinery` previously emitted a `cleanupForDestroy` block
unconditionally, alongside the normal `cleanup` block. That block is
only ever used as the "destroy" successor of an `async.coro.suspend`,
so for coroutines that never suspend (e.g. an `async.func` whose body
contains no `async.await`) it ended up unreachable in the lowered CFG.

Make `cleanupForDestroy` mirror the existing `setError` pattern and
materialize it lazily via a new `setupCleanupForDestroyBlock` helper,
called only from the two places (`outlineExecuteOp` and the
`async.await` lowering) that actually wire it up. Store the coroutine
id on `CoroMachinery` so the helper can rebuild the block contents
without keeping the original `async.coro.id` op around.

Assisted-by: Opus 4.7



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