[PATCH] D23245: [Coroutines] Part 6: Elide dynamic allocation of a coroutine frame when possible

Gor Nishanov via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 9 13:13:48 PDT 2016


GorNishanov added inline comments.

================
Comment at: lib/Transforms/Coroutines/CoroElide.cpp:129
@@ +128,3 @@
+
+  auto *Frame = new AllocaInst(FrameTy, "", InsertPt);
+  auto *FrameVoidPtr =
----------------
majnemer wrote:
> Do we have to worry about the alignment of this alloca?
Added comment:
  // FIXME: Design how to transmit alignment information for every alloca that
  // is spilled into the coroutine frame and recreate the alignment information
  // here. Possibly we will need to do a mini SROA here and break the coroutine
  // frame into individual AllocaInst recreating the original alignment.


================
Comment at: lib/Transforms/Coroutines/CoroElide.cpp:194-195
@@ +193,4 @@
+
+  // If llvm.coro.begin refers to llvm.coro.alloc, we can elide the allocation.
+  auto *AllocInst = CoroBegin->getAlloc();
+
----------------
majnemer wrote:
> majnemer wrote:
> > We would typically sink this assignment into the if.
> Is this still safe if there are multiple coro.begin calls and some of them refer to llvm.coro.alloc and others do not?
Addressed by making coro.begin return the token and coro.frame taken that token returning the coroutine frame address. This should prevent coro.begin being duplicated.



https://reviews.llvm.org/D23245





More information about the llvm-commits mailing list