[PATCH] D24068: [Coroutines] Part11: Add final suspend handling.

Gor Nishanov via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 30 20:54:24 PDT 2016


GorNishanov created this revision.
GorNishanov added a reviewer: majnemer.
GorNishanov added a subscriber: llvm-commits.
Herald added a subscriber: mehdi_amini.

A frontend may designate a particular suspend to be final, by setting the second argument of the coro.suspend intrinsic to true. Such a suspend point has two properties:

* it is possible to check whether a suspended coroutine is at the final suspend point via coro.done intrinsic;
* a resumption of a coroutine stopped at the final suspend point leads to undefined behavior. The only possible action for a coroutine at a final suspend point is destroying it via coro.destroy intrinsic.

This patch adds final suspend handling logic to CoroEarly and CoroSplit passes.
Now, the final suspend point example from docs\Coroutines.rst compiles and produces expected result (see test/Transform/Coroutines/ex5.ll).

https://reviews.llvm.org/D24068

Files:
  lib/Transforms/Coroutines/CoroEarly.cpp
  lib/Transforms/Coroutines/CoroSplit.cpp
  lib/Transforms/Coroutines/Coroutines.cpp
  test/Transforms/Coroutines/ex5.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D24068.69794.patch
Type: text/x-patch
Size: 11220 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160831/81ce5b5a/attachment.bin>


More information about the llvm-commits mailing list