[PATCH] D92706: [coroutine] should disable inline before calling coro split
Xun Li via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 4 16:12:29 PST 2020
lxfind created this revision.
lxfind added reviewers: junparser, wenlei, MaskRay, dongAxis1944.
Herald added subscribers: hoy, dexonsmith, modimo, modocache, haicheng, hiraditya, eraman.
lxfind requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
This is a rework of D85812 <https://reviews.llvm.org/D85812>, which didn't land.
When callee coroutine function is inlined into caller coroutine function before coro-split pass, llvm will emits "coroutine should have exactly one defining @llvm.coro.begin". It seems that coro-early pass can not handle this quiet well.
So we believe that unsplited coroutine function should not be inlined.
This patch fix such issue by not inlining function if it has attribute "coroutine.presplit" (it means the function has not been splited) to fix this issue
test plan: check-llvm, check-clang
In D85812 <https://reviews.llvm.org/D85812>, there was suggestions on moving the macros to Attributes.td to avoid circular header dependency issue.
I believe it's not worth doing just to be able to use one constant string in one place.
Today, there are already 3 possible attribute values for "coroutine.presplit": https://github.com/llvm/llvm-project/blob/c6543cc6b8f107b58e7205d8fc64865a508bacba/llvm/lib/Transforms/Coroutines/CoroInternal.h#L40-L42
If we move them into Attributes.td, we would be adding 3 new attributes to EnumAttr, just to support this, which I think is an overkill.
Instead, I think the best way to do this is to add an API in Function class that checks whether this function is a coroutine, by checking the attribute by name directly.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D92706
Files:
llvm/include/llvm/IR/Function.h
llvm/lib/Analysis/InlineCost.cpp
llvm/lib/Transforms/IPO/AlwaysInliner.cpp
llvm/test/Transforms/Coroutines/coro-inline.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D92706.309694.patch
Type: text/x-patch
Size: 5860 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201205/af2ccfcc/attachment.bin>
More information about the llvm-commits
mailing list