[PATCH] D96922: [Coroutine] Check indirect uses of alloca when checking lifetime info

Chuanqi Xu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 23 18:24:19 PST 2021


ChuanqiXu added a comment.

In D96922#2581141 <https://reviews.llvm.org/D96922#2581141>, @rjmccall wrote:

> Is there any way we can simplify this problem for ourselves by expecting IR to be emitted differently within coroutines?  Because I think the true fundamental problem here is that LLVM's representation of stack allocations is not very good, and we're stuck trying to do an analysis that the representation isn't suited for at all.  There's no real chance that LLVM in general is going to move away from `alloca`, but if we can recognize when we're emitting one of these allocations that needs to overlap `coro.begin` or `coro.end` and just do it with a special intrinsic that we treat differently in lowering, that might substantially reduce the difficulty of the problem.  If necessary, we can even change the rules for inlining into unsplit coroutines.

IIRC, coroutine developers already complain about the design of coroutine many times like D96928 <https://reviews.llvm.org/D96928>. But just like @lxfind says, it is impossible that we can redesign the mechanism in a short time. I agree with that we should discuss how to refactor the struct of coroutine to solve these problems fundamentally. Before we get a clear solution, I think it is ok to fix bugs like this patch and add verify phase to tell the user what's going wrong.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D96922/new/

https://reviews.llvm.org/D96922



More information about the llvm-commits mailing list