Go to file
Gor Nishanov 1b6aec8e25 [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
clang Rename variable to not use C++ reserved name (leading underscore + capital) (NFC) 2016-10-07 22:03:03 +00:00
clang-tools-extra Revert "[clang-move] Support moving multiple classes in one run." 2016-10-07 13:58:10 +00:00
compiler-rt [esan] Fix ESan test failure on Debian Sid bot 2016-10-07 20:53:35 +00:00
debuginfo-tests New round of fixes for "Always compile debuginfo-tests for the host triple" 2014-10-18 23:47:59 +00:00
libclc Provide vstore_half helper to workaround clc restrictions 2016-09-21 20:15:55 +00:00
libcxx Disable alignment support of 0x4000 for Win32. https://reviews.llvm.org/D25053 2016-10-07 23:19:04 +00:00
libcxxabi Recommit r282692: [libc++abi] Use fallback_malloc to allocate __cxa_eh_globals in case of dynamic memory exhaustion. 2016-10-07 08:48:28 +00:00
libunwind libunwind: Add OpenBSD case for _Unwind_Ptr typedef 2016-09-28 15:37:21 +00:00
lld Improve comments. 2016-10-07 19:54:57 +00:00
lldb Fix a few warnings caught by clang. 2016-10-07 21:32:16 +00:00
llgo [llgo] add llgo source path to LLVM_GO_PACKAGES 2016-07-27 03:01:00 +00:00
llvm [coroutines] Store an address of destroy OR cleanup part in the coroutine frame. 2016-10-08 00:22:50 +00:00
openmp Code cleanup for the runtime without monitor thread 2016-10-07 18:12:19 +00:00
parallel-libs [SE] Change CoreTests target name 2016-09-27 15:32:52 +00:00
polly Define PATH_MAX on windows 2016-10-07 20:58:20 +00:00