[coroutines] Add support for deallocation elision
authorGor Nishanov <GorNishanov@gmail.com>
Tue, 23 May 2017 04:21:27 +0000 (04:21 +0000)
committerGor Nishanov <GorNishanov@gmail.com>
Tue, 23 May 2017 04:21:27 +0000 (04:21 +0000)
commit6954b2e3b2514855857aa20b5111f9ec8f0649e3
treeeea3f789159634c0fbd4ba341087e109ebe4501e
parentea779cc39670cf5f3e1cee63a7909eebdb0083cb
[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
lib/CodeGen/CGCoroutine.cpp
test/CodeGenCoroutines/coro-alloc.cpp