[llvm] [CoroEarly] Hide promise alloca for later passes (PR #139243)
Chuanqi Xu via llvm-commits
llvm-commits at lists.llvm.org
Tue May 13 19:06:30 PDT 2025
ChuanqiXu9 wrote:
> > But why do we hack in CoroEarly pass? Can't we generate yet another intrinsic in the frontend?
>
> The intrinsic cannot be `coro.promise` because we should not assume the frontend won't emit other `coro.promise` calls to the coroutine body. This would make later replacements infeasible.
>
> We can certainly generate another intrinsic in the frontend. However, there have been too many coroutine-related intrinsics. I would personally prefer to avoid introducing new intrinsic unless necessary. `coro.promise` shall do it work well.
I think it is better to consider if it should be instead of the numbers. `coro.promise()` is not appropriate since it is a consumer. We need a producer for this.
>
> > why promise is different from other allocas in the purpose (avoid mis-optimization)?
>
> Only the promise alloca is visible to the caller, whereas other allocas remain internal. This visibility difference accounts for the observed mis-optimization effect.
https://github.com/llvm/llvm-project/pull/139243
More information about the llvm-commits
mailing list