[WebAssembly] Don't set musttail for coroutines when tail-call is not
authorChuanqi Xu <yedeng.yd@linux.alibaba.com>
Wed, 29 Jun 2022 04:48:48 +0000 (12:48 +0800)
committerChuanqi Xu <yedeng.yd@linux.alibaba.com>
Thu, 30 Jun 2022 03:15:40 +0000 (11:15 +0800)
commit0b5ead659023dedd6c450657df9f242a2819871a
tree3273057006c19d569f86787e1323ce789eb5356c
parentfa8656d28d795a45dd76f5ca6030c5eef4c7003a
[WebAssembly] Don't set musttail for coroutines when tail-call is not
enabled

The C++20 Coroutines couldn't be compiled to WebAssembly due to an
optimization named symmetric transfer requires the support for musttail
calls but WebAssembly doesn't support it yet.

This patch tries to fix the problem by adding a supportsTailCalls
method to TargetTransformImpl to skip the symmetric transfer when
tail-call feature is not supported.

Reviewed By: tlively

Differential Revision: https://reviews.llvm.org/D128794
llvm/include/llvm/Analysis/TargetTransformInfo.h
llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
llvm/lib/Analysis/TargetTransformInfo.cpp
llvm/lib/Target/WebAssembly/WebAssemblyTargetTransformInfo.cpp
llvm/lib/Target/WebAssembly/WebAssemblyTargetTransformInfo.h
llvm/lib/Transforms/Coroutines/CoroSplit.cpp
llvm/test/Transforms/Coroutines/coro-split-musttail10.ll [new file with mode: 0644]
llvm/test/Transforms/Coroutines/coro-split-musttail11.ll [new file with mode: 0644]
llvm/test/Transforms/Coroutines/coro-split-musttail8.ll [new file with mode: 0644]
llvm/test/Transforms/Coroutines/coro-split-musttail9.ll [new file with mode: 0644]