[PATCH] D23993: [Coroutines] Part 10: Add coroutine promise support.

Gor Nishanov via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 29 21:13:53 PDT 2016

GorNishanov marked 6 inline comments as done.

Comment at: lib/Transforms/Coroutines/CoroInstr.h:104-105
@@ +103,4 @@
+      return;
+    assert((isa<BitCastInst>(Arg) || isa<GetElementPtrInst>(Arg)) &&
+           "unexpected instruction designating the promise");
+    // TODO: Add a check that any remaining users of Inst are after coro.begin
majnemer wrote:
> This is weird.  There can be `ptrtoint`/`inttoptr` pairs, etc.  Why do you have this restriction?
Mostly I wanted to observe what else could be used to convert alloca %promise-type into void* parameter, so that I can correctly move them after coro.begin (in case when they are used by something other than coro.begin).

coro.begin marks the point where we know the address of the coroutine frame, so anything touching the coroutine frame should appear after it. Since promise alloca always goes to coroutine frame.

I'd like to keep it for now and revisit it in patch 12 where I add code to deal with various instructions that may appear before coro.begin that would need be moved after it. That will give us more tools to deal with ptrtoint/inttoptr possibility.


More information about the llvm-commits mailing list