[llvm] [CoroEarly] Hide promise alloca for later passes (PR #139243)

Weibo He via llvm-commits llvm-commits at lists.llvm.org
Fri May 16 00:53:02 PDT 2025


================
@@ -175,6 +199,23 @@ void Lowerer::lowerEarlyIntrinsics(Function &F) {
     switch (CB->getIntrinsicID()) {
       default:
         continue;
+      case Intrinsic::coro_begin:
+      case Intrinsic::coro_begin_custom_abi: {
+        auto CBI = cast<CoroBeginInst>(&I);
+
+        // Ignore coro id's that aren't pre-split.
+        auto Id = dyn_cast<CoroIdInst>(CBI->getId());
+        if (Id && !Id->getInfo().isPreSplit())
+          break;
+
+        if (CoroBegin)
+          report_fatal_error(
+              "coroutine should have exactly one defining @llvm.coro.begin");
+        CBI->addRetAttr(Attribute::NonNull);
+        CBI->addRetAttr(Attribute::NoAlias);
----------------
NewSigma wrote:

Of course we can.

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


More information about the llvm-commits mailing list