[coro] Async coroutines: Allow more than 3 arguments in the dispatch function
authorArnold Schwaighofer <aschwaighofer@apple.com>
Mon, 9 Nov 2020 20:05:57 +0000 (12:05 -0800)
committerArnold Schwaighofer <aschwaighofer@apple.com>
Wed, 11 Nov 2020 23:25:28 +0000 (15:25 -0800)
commit431337662ee01bedb2f2a45fba960bfc7388adb6
tree4f1df7ba81086c8e85a52f315b30f033b3a04e61
parentb6ccff3d5f3b8e26439c7471f433cb16eaf66863
[coro] Async coroutines: Allow more than 3 arguments in the dispatch function

We need to be able to call function pointers. Inline the dispatch
function.

Also inline the context projection function.

Transfer debug locations from the suspend point to the inlined functions.

Use the function argument index instead of the function argument in
coro.id.async. This solves any spurious use issues.

Coerce the arguments of the tail call function at a suspend point. The LLVM
optimizer seems to drop casts leading to a vararg intrinsic.

rdar://70097093

Differential Revision: https://reviews.llvm.org/D91098
llvm/include/llvm/IR/Intrinsics.td
llvm/lib/Transforms/Coroutines/CoroFrame.cpp
llvm/lib/Transforms/Coroutines/CoroInstr.h
llvm/lib/Transforms/Coroutines/CoroSplit.cpp
llvm/lib/Transforms/Coroutines/Coroutines.cpp
llvm/test/Transforms/Coroutines/coro-async.ll