diff options
author | Gor Nishanov <GorNishanov@gmail.com> | 2017-05-23 04:21:27 +0000 |
---|---|---|
committer | Gor Nishanov <GorNishanov@gmail.com> | 2017-05-23 04:21:27 +0000 |
commit | 6954b2e3b2514855857aa20b5111f9ec8f0649e3 (patch) | |
tree | eea3f789159634c0fbd4ba341087e109ebe4501e /test/CodeGenCoroutines | |
parent | ea779cc39670cf5f3e1cee63a7909eebdb0083cb (diff) |
[coroutines] Add support for deallocation elision
Wrap deallocation code with:
if (auto *mem = coro.free()) Deallocate
When backend decides to elide allocations it will replace coro.free with nullptr to suppress deallocation code.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@303599 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenCoroutines')
-rw-r--r-- | test/CodeGenCoroutines/coro-alloc.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/test/CodeGenCoroutines/coro-alloc.cpp b/test/CodeGenCoroutines/coro-alloc.cpp index 730fc37c21..820201db35 100644 --- a/test/CodeGenCoroutines/coro-alloc.cpp +++ b/test/CodeGenCoroutines/coro-alloc.cpp @@ -69,7 +69,15 @@ extern "C" void f0(global_new_delete_tag) { // CHECK: %[[FRAME:.+]] = call i8* @llvm.coro.begin(token %[[ID]], i8* %[[PHI]]) // CHECK: %[[MEM:.+]] = call i8* @llvm.coro.free(token %[[ID]], i8* %[[FRAME]]) + // CHECK: %[[NeedDealloc:.+]] = icmp ne i8* %[[MEM]], null + // CHECK: br i1 %[[NeedDealloc]], label %[[FreeBB:.+]], label %[[Afterwards:.+]] + + // CHECK: [[FreeBB]]: // CHECK: call void @_ZdlPv(i8* %[[MEM]]) + // CHECK: br label %[[Afterwards]] + + // CHECK: [[Afterwards]]: + // CHECK: ret void co_return; } |