[all-commits] [llvm/llvm-project] 9f77c2: [CoroEarly] Hide promise alloca for later passes (...

Weibo He via All-commits all-commits at lists.llvm.org
Fri May 16 02:23:25 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9f77c26ec641c7f0c353f74ee6ee072086e2f3d7
      https://github.com/llvm/llvm-project/commit/9f77c26ec641c7f0c353f74ee6ee072086e2f3d7
  Author: Weibo He <NewSigma at 163.com>
  Date:   2025-05-16 (Fri, 16 May 2025)

  Changed paths:
    M llvm/docs/Coroutines.rst
    M llvm/include/llvm/Transforms/Coroutines/CoroShape.h
    M llvm/lib/Transforms/Coroutines/CoroEarly.cpp
    M llvm/lib/Transforms/Coroutines/Coroutines.cpp
    A llvm/test/Transforms/Coroutines/gh105595.ll

  Log Message:
  -----------
  [CoroEarly] Hide promise alloca for later passes (#139243)

Currently coroutine promises are modeled as allocas. This is problematic
because other middle-end passes will assume promise dead after coroutine
suspend, leading to misoptimizations.

I propose the front ends remain free to emit and use allocas to model
coro promise. At CoroEarly, we will replace all uses of promise alloca
with `coro.promise`. Non coroutine passes should only access promise
through `coro.promise`. Then at CoroSplit, we will lower `coro.promise`
back to promise alloca again. So that it will be correctly collected
into coro frame. Note that we do not have to bother maintainers of other
middle-end passes.

Fix #105595



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