This is an archive of the discontinued LLVM Phabricator instance.

[Coroutines] Part15c: Fix coro-split to correctly handle definitions between coro.save and coro.suspend
ClosedPublic

Authored by GorNishanov on Sep 9 2016, 12:04 PM.
Tokens
"Yellow Medal" token, awarded by GorNishanov.

Details

Summary

In the case below, %Result.i19 is defined between coro.save and coro.suspend and used after coro.suspend. We need to correctly place such a value into the coroutine frame.

  %save = call token @llvm.coro.save(i8* null)
  %Result.i19 = getelementptr inbounds %"struct.lean_future<int>::Awaiter", %"struct.lean_future<int>::Awaiter"* %ref.tmp7, i64 0, i32 0
  %suspend = call i8 @llvm.coro.suspend(token %save, i1 false)
  switch i8 %suspend, label %exit [
    i8 0, label %await.ready
    i8 1, label %exit
  ]
await.ready:
  %val = load i32, i32* %Result.i19

Diff Detail

Repository
rL LLVM

Event Timeline

GorNishanov retitled this revision from to [Coroutines] Part15c: Fix coro-split to correctly handle definitions between coro.save and coro.suspend.
GorNishanov updated this object.
GorNishanov added a reviewer: majnemer.
GorNishanov added a subscriber: llvm-commits.

And the last ping for today!

majnemer accepted this revision.Sep 30 2016, 10:45 AM
majnemer edited edge metadata.

LGTM

This revision is now accepted and ready to land.Sep 30 2016, 10:45 AM
This revision was automatically updated to reflect the committed changes.