[llvm] [Coroutines] Make CoroElide actually work for (trivial) C++ coroutines (PR #92969)
Yuxuan Chen via llvm-commits
llvm-commits at lists.llvm.org
Thu May 23 14:27:41 PDT 2024
================
@@ -193,23 +195,51 @@ CoroIdElider::CoroIdElider(CoroIdInst *CoroId, FunctionElideInfo &FEI,
CoroAllocs.push_back(CA);
}
+ DenseMap<AllocaInst *, CoroBeginInst *> Writes;
+ for (CoroBeginInst *CB : CoroBegins) {
+ for (User *U : CB->users()) {
+ if (auto *Store = dyn_cast<StoreInst>(U)) {
----------------
yuxuanchen1997 wrote:
This alloca is clang generated. (usually just the temporary value of type `Task`.) I am thinking that if we can somehow annotate from the front end which field in a `Task` is a handle, we can potentially avoid having to do a convoluted analysis that's not easy to get right.
Are you asking whether this `%t = alloca %Task` gets `store`d into another `alloca`ed stack memory? Yes it does. Usually operator co_await does that to create an `Awaiter` object.
https://github.com/llvm/llvm-project/pull/92969
More information about the llvm-commits
mailing list