1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 19:23:23 +01:00
llvm-mirror/test/Transforms/Coroutines
Gor Nishanov 680815e118 [coroutines] Store an address of destroy OR cleanup part in the coroutine frame.
Summary:
If heap allocation of a coroutine is elided, we need to make sure that we will update an address stored in the coroutine frame from f.destroy to f.cleanup.
Before this change, CoroSplit synthesized these stores after coro.begin:

```
    store void (%f.Frame*)* @f.resume, void (%f.Frame*)** %resume.addr
    store void (%f.Frame*)* @f.destroy, void (%f.Frame*)** %destroy.addr

```

In those cases where we did heap elision, but were not able to devirtualize all indirect calls, destroy call will attempt to "free" the coroutine frame stored on the stack. Oops.

Now we use select to put an appropriate coroutine subfunction in the destroy slot. As bellow:

```
    store void (%f.Frame*)* @f.resume, void (%f.Frame*)** %resume.addr
    %0 = select i1 %need.alloc, void (%f.Frame*)* @f.destroy, void (%f.Frame*)* @f.cleanup
    store void (%f.Frame*)* %0, void (%f.Frame*)** %destroy.addr
```

Reviewers: majnemer

Subscribers: mehdi_amini, llvm-commits

Differential Revision: https://reviews.llvm.org/D25377

llvm-svn: 283625
2016-10-08 00:22:50 +00:00
..
ArgAddr.ll [Coroutines] Part12: Handle alloca address-taken 2016-09-05 23:45:45 +00:00
coro-cleanup.ll [Coroutines] Part 15a: Lower coro.subfn.addr in CoroCleanup 2016-09-30 18:41:35 +00:00
coro-early.ll
coro-elide.ll
coro-heap-elide.ll
coro-split-00.ll [coroutines] Store an address of destroy OR cleanup part in the coroutine frame. 2016-10-08 00:22:50 +00:00
coro-split-01.ll
coro-split-02.ll [Coroutines] Part15c: Fix coro-split to correctly handle definitions between coro.save and coro.suspend 2016-09-30 19:24:19 +00:00
coro-split-dbg.ll [Coroutines] Part15b: Fix dbg information handling in coro-split. 2016-09-30 19:05:06 +00:00
ex0.ll
ex1.ll
ex2.ll
ex3.ll
ex4.ll
ex5.ll [Coroutines] Part11: Add final suspend handling. 2016-09-05 04:44:30 +00:00
no-suspend.ll [Coroutines] Part14: Handle coroutines with no suspend points. 2016-09-26 15:49:28 +00:00
phi-coro-end.ll [Coroutines] Part13: Handle single edge PHINodes across suspends 2016-09-09 05:39:00 +00:00
restart-trigger.ll
smoketest.ll