[Coroutines] Move CoroEarly pass to before AlwaysInliner
authorXun Li <lxfind@gmail.com>
Mon, 12 Apr 2021 05:01:36 +0000 (22:01 -0700)
committerXun Li <lxfind@gmail.com>
Sun, 18 Apr 2021 21:54:04 +0000 (14:54 -0700)
commit2b50f5a4343f8fb06acaa5c36355bcf58092c9cd
tree91170e62bfa44a793690b5eeb9e75f3de0232eb9
parentd0b03ec401e8465b88893a4c56aeb0c787a54ad9
[Coroutines] Move CoroEarly pass to before AlwaysInliner

Presplit coroutines cannot be inlined. During AlwaysInliner we check if a function is a presplit coroutine, if so we skip inlining.
The presplit coroutine attributes are set in CoroEarly pass.
However in O0 pipeline, AlwaysInliner runs before CoroEarly, so the attribute isn't set yet and will still inline the coroutine.
This causes Clang to crash: https://bugs.llvm.org/show_bug.cgi?id=49920

Differential Revision: https://reviews.llvm.org/D100282
16 files changed:
clang/lib/CodeGen/CGCoroutine.cpp
clang/test/CodeGenCoroutines/coro-always-inline-resume.cpp [new file with mode: 0644]
clang/test/CodeGenCoroutines/coro-always-inline.cpp
llvm/lib/Transforms/Coroutines/CoroEarly.cpp
llvm/test/Transforms/Coroutines/coro-debug-O2.ll
llvm/test/Transforms/Coroutines/coro-debug-frame-variable.ll
llvm/test/Transforms/Coroutines/coro-split-01.ll
llvm/test/Transforms/Coroutines/coro-split-recursive.ll
llvm/test/Transforms/Coroutines/ex0.ll
llvm/test/Transforms/Coroutines/ex1.ll
llvm/test/Transforms/Coroutines/ex2.ll
llvm/test/Transforms/Coroutines/ex3.ll
llvm/test/Transforms/Coroutines/ex4.ll
llvm/test/Transforms/Coroutines/ex5.ll
llvm/test/Transforms/Coroutines/phi-coro-end.ll
llvm/test/Transforms/Coroutines/restart-trigger.ll