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

Gor Nishanov via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 9 12:04:28 PDT 2016


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

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

```

https://reviews.llvm.org/D24418

Files:
  lib/Transforms/Coroutines/CoroFrame.cpp
  test/Transforms/Coroutines/coro-split-02.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D24418.70883.patch
Type: text/x-patch
Size: 6182 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160909/2fa2364c/attachment.bin>


More information about the llvm-commits mailing list