[Coroutine] Do not CoroElide if there are musttail calls
authorXun Li <lxfind@gmail.com>
Mon, 18 Jan 2021 17:06:21 +0000 (09:06 -0800)
committerXun Li <lxfind@gmail.com>
Mon, 18 Jan 2021 17:06:21 +0000 (09:06 -0800)
commit1d04dc52dd24d791970e56053cdd67fe149b0554
treebdec20ce72937d5fc139dcb4213dce4ba507c3a1
parent275716d6db79a6da3d5cee12139dd0c0abf8fd07
[Coroutine] Do not CoroElide if there are musttail calls

This is to address https://bugs.llvm.org/show_bug.cgi?id=48626.
When there are musttail calls that use parameters aliasing the newly created coroutine frame, the existing implementation will fatal.
We simply cannot perform CoroElide in such cases. In theory a precise analysis can be done to check whether the parameters of the musttail call
actually alias the frame, but it's very hard to do it before the transformation happens. Also in most cases the existence of musttail call is
generated due to symmetric transfers, and in those cases alias analysis won't be able to tell that they don't alias anyway.

Differential Revision: https://reviews.llvm.org/D94834
llvm/lib/Transforms/Coroutines/CoroElide.cpp
llvm/test/Transforms/Coroutines/coro-elide-musttail.ll [new file with mode: 0644]