aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/InlineFunction.cpp
diff options
context:
space:
mode:
authorChuanqi Xu <yedeng.yd@linux.alibaba.com>2021-07-15 14:31:31 +0800
committerChuanqi Xu <yedeng.yd@linux.alibaba.com>2021-07-15 14:33:40 +0800
commit8a1727ba51d262365b0d9fe10fef7e50da7022cd (patch)
tree9f75fc8c9586e4797314273434e7a848796b8a2b /llvm/lib/Transforms/Utils/InlineFunction.cpp
parent0f9e6451a836886f39137818c4f0cfd69ae31e62 (diff)
downloadllvm-8a1727ba51d262365b0d9fe10fef7e50da7022cd.zip
llvm-8a1727ba51d262365b0d9fe10fef7e50da7022cd.tar.gz
llvm-8a1727ba51d262365b0d9fe10fef7e50da7022cd.tar.bz2
[Coroutines] Run coroutine passes by default
This patch make coroutine passes run by default in LLVM pipeline. Now the clang and opt could handle IR inputs containing coroutine intrinsics without special options. It should be fine. On the one hand, the coroutine passes seems to be stable since there are already many projects using coroutine feature. On the other hand, the coroutine passes should do nothing for IR who doesn't contain coroutine intrinsic. Test Plan: check-llvm Reviewed by: lxfind, aeubanks Differential Revision: https://reviews.llvm.org/D105877
Diffstat (limited to 'llvm/lib/Transforms/Utils/InlineFunction.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/InlineFunction.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Utils/InlineFunction.cpp b/llvm/lib/Transforms/Utils/InlineFunction.cpp
index d613aab..f694a8b 100644
--- a/llvm/lib/Transforms/Utils/InlineFunction.cpp
+++ b/llvm/lib/Transforms/Utils/InlineFunction.cpp
@@ -2189,7 +2189,11 @@ llvm::InlineResult llvm::InlineFunction(CallBase &CB, InlineFunctionInfo &IFI,
// Leave lifetime markers for the static alloca's, scoping them to the
// function we just inlined.
- if (InsertLifetime && !IFI.StaticAllocas.empty()) {
+ // We need to insert lifetime intrinsics even at O0 to avoid invalid
+ // access caused by multithreaded coroutines. The check
+ // `Caller->isPresplitCoroutine()` would affect AlwaysInliner at O0 only.
+ if ((InsertLifetime || Caller->isPresplitCoroutine()) &&
+ !IFI.StaticAllocas.empty()) {
IRBuilder<> builder(&FirstNewBlock->front());
for (unsigned ai = 0, ae = IFI.StaticAllocas.size(); ai != ae; ++ai) {
AllocaInst *AI = IFI.StaticAllocas[ai];