[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
Thu Feb 18 17:59:51 PST 2021


ChuanqiXu added a comment.

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

> In general, we cannot ever assume that we can see all uses of the alloca, whether direct or indirect; we can do our best when we can reason about particular uses, but we have to have some ability to recognize that the address may have escaped and therefore basically any point within the lifetime of the alloca might be a use.  It doesn't seem like this gets us to that point yet.

Maybe we need to introduce AA or memorySSA to this pass to do that. And from my point of view, the solution now (by AllocaUseVisitor) can be a workaround. We could do analysis in AllocaUseVisitor as conservatively as we could before we introduce memorySSA or AA.



================
Comment at: llvm/lib/Transforms/Coroutines/CoroFrame.cpp:1021
+
     if (PI.isEscaped())
       return true;
----------------
Maybe we need to forward the judgement for `PI.isEscaped()` to the front. Below is an example I find:
```
%a = alloca ...
%b = alloca ...
llvm.lifetime.start(%a)
call @f(%a, %b) ; %a maybe alias with %b and the `users` doesn't contain `%b` 
suspend point
; usage of %b ; so the memory access may not be right
```


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