[PATCH] D86859: [Coroutine] Make dealing with alloca spills more robust

Chuanqi Xu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 3 18:28:02 PDT 2020


ChuanqiXu added inline comments.


================
Comment at: llvm/lib/Transforms/Coroutines/CoroFrame.cpp:1002
   // the spill slot in the coroutine frame.
   if (MightNeedToCopy) {
     Builder.SetInsertPoint(FramePtr->getNextNode());
----------------
lxfind wrote:
> ChuanqiXu wrote:
> > If there is a case:
> > ```
> > %a = alloca..
> > %b = bitcast  %a to ...
> > @coro.begin
> > // some use of b but no use of a
> > ```
> > in this case, all the use of `%a` is dominated by Coro.begin, so the variable `MightNeedToCopy` may not be true, then the codes before won't be executed.
> > 
> > 
> MightNeedToCopy will be true if any use if the AllocaInst is not dominated by coro.begin. So in your example, since %b uses %a and happens before coro.begin, it's not dominated by coro.begin, and hence MightNeedToCopy will be true.
Yes, you are right.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D86859



More information about the llvm-commits mailing list