[llvm-branch-commits] [llvm] [LLVM][Coroutines] Create `.noalloc` variant of switch ABI coroutine ramp functions during CoroSplit (PR #99283)

Yuxuan Chen via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Jul 19 14:08:32 PDT 2024


================
@@ -1455,6 +1462,64 @@ struct SwitchCoroutineSplitter {
     setCoroInfo(F, Shape, Clones);
   }
 
+  static Function *createNoAllocVariant(Function &F, coro::Shape &Shape,
+                                        SmallVectorImpl<Function *> &Clones) {
+    auto *OrigFnTy = F.getFunctionType();
+    auto OldParams = OrigFnTy->params();
+
+    SmallVector<Type *> NewParams;
+    NewParams.reserve(OldParams.size() + 1);
+    for (Type *T : OldParams) {
+      NewParams.push_back(T);
+    }
+    NewParams.push_back(PointerType::getUnqual(Shape.FrameTy));
+
+    auto *NewFnTy = FunctionType::get(OrigFnTy->getReturnType(), NewParams,
+                                      OrigFnTy->isVarArg());
+    Function *NoAllocF =
+        Function::Create(NewFnTy, F.getLinkage(), F.getName() + ".noalloc");
----------------
yuxuanchen1997 wrote:

Does ThinLTO count as Cross-TU?

https://github.com/llvm/llvm-project/pull/99283


More information about the llvm-branch-commits mailing list