This is an archive of the discontinued LLVM Phabricator instance.

[Coroutines] Part11: Add final suspend handling.
ClosedPublic

Authored by GorNishanov on Aug 30 2016, 8:54 PM.

Details

Summary

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).

Diff Detail

Event Timeline

GorNishanov retitled this revision from to [Coroutines] Part11: Add final suspend handling..
GorNishanov updated this object.
GorNishanov added a reviewer: majnemer.
GorNishanov added a subscriber: llvm-commits.
majnemer accepted this revision.Sep 4 2016, 8:16 PM
majnemer edited edge metadata.

LGTM

This revision is now accepted and ready to land.Sep 4 2016, 8:16 PM
This revision was automatically updated to reflect the committed changes.