================
@@ -523,6 +523,12 @@ void CodeGenFunction::FinishFunction(SourceLocation 
EndLoc) {
     NormalCleanupDest = Address::invalid();
   }
 
+  if (getLangOpts().Coroutines && isCoroutine()) {
+    auto *Record = FnRetTy->getAsCXXRecordDecl();
+    if (Record && Record->hasAttr<CoroAwaitElidableAttr>())
+      CurFn->addFnAttr(llvm::Attribute::CoroGenNoallocRamp);
+  }
----------------
ChuanqiXu9 wrote:
I don't like this. It will add this attribute to all the coroutines with the 
attribute 
`[[[clang::coro_await_elidable]]](https://github.com/llvm/llvm-project/pull/99282/files#top)`.
 In practice it may always cause the CoroSplit pass to generate additional 
codes.

What I thought is, in CoroSplit pass, we can visit every user of the function, 
and if any user of the function is a call with the elide attribute, we can 
generate .noalloc variant for the current coroutine. 

https://github.com/llvm/llvm-project/pull/99282
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to