Skip to content

Conversation

@NewSigma
Copy link
Contributor

@NewSigma NewSigma commented Aug 13, 2025

As mentioned in #151067, current design of llvm.coro.end mixes two functionalities: querying where we are and lowering to some code. This patch separate these functionalities into independent intrinsics by introducing a new intrinsic llvm.coro.is_in_ramp.

@github-actions
Copy link

github-actions bot commented Aug 13, 2025

✅ With the latest revision this PR passed the C/C++ code formatter.

@NewSigma NewSigma marked this pull request as ready for review August 14, 2025 11:09
@llvmbot llvmbot added clang Clang issues not falling into any other category clang:codegen IR generation bugs: mangling, exceptions, etc. mlir:llvm mlir coroutines C++20 coroutines llvm:ir llvm:analysis Includes value tracking, cost tables and constant folding llvm:transforms labels Aug 14, 2025
@llvmbot
Copy link
Member

llvmbot commented Aug 14, 2025

@llvm/pr-subscribers-llvm-transforms
@llvm/pr-subscribers-llvm-analysis
@llvm/pr-subscribers-mlir-llvm
@llvm/pr-subscribers-mlir

@llvm/pr-subscribers-clang-codegen

Author: Weibo He (NewSigma)

Changes

As mentioned in #151067, current design of llvm.coro.end mixes two functionalities: querying where we are and lowering to some code. This patch separate these functionalities into independent intrinsics by introducing a new intrinsic llvm.coro.where.


Patch is 149.25 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/153404.diff

147 Files Affected:

  • (modified) clang/lib/CodeGen/CGCoroutine.cpp (+8-6)
  • (modified) clang/test/CodeGenCoroutines/coro-builtins.c (+1-1)
  • (modified) clang/test/CodeGenCoroutines/coro-eh-cleanup.cpp (+2-2)
  • (modified) clang/test/CodeGenCoroutines/coro-lambda.cpp (+1-1)
  • (modified) clang/test/CodeGenCoroutines/coro-params.cpp (+2-2)
  • (modified) llvm/docs/Coroutines.rst (+38-13)
  • (modified) llvm/include/llvm/IR/Intrinsics.td (+3-2)
  • (modified) llvm/include/llvm/Transforms/Coroutines/CoroInstr.h (+12)
  • (modified) llvm/include/llvm/Transforms/Coroutines/CoroShape.h (+2)
  • (modified) llvm/lib/Transforms/Coroutines/CoroCleanup.cpp (+1-1)
  • (modified) llvm/lib/Transforms/Coroutines/CoroCloner.h (+1)
  • (modified) llvm/lib/Transforms/Coroutines/CoroSplit.cpp (+21-8)
  • (modified) llvm/lib/Transforms/Coroutines/Coroutines.cpp (+4)
  • (modified) llvm/test/Analysis/GlobalsModRef/nonescaping-noalias.ll (+2-2)
  • (modified) llvm/test/Assembler/auto_upgrade_intrinsics.ll (+3-3)
  • (modified) llvm/test/Transforms/Coroutines/ArgAddr.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-align16.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-align32.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-align64-02.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-align64.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-align8-02.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-align8.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-alloc-with-param-O0.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-alloc-with-param-O2.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-alloca-01.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-alloca-02.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-alloca-03.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-alloca-04.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-alloca-05.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-alloca-06.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-alloca-07.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-alloca-08.ll (+3-3)
  • (modified) llvm/test/Transforms/Coroutines/coro-alloca-loop-carried-address.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-alloca-outside-frame.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-alloca-with-addrspace.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-async-addr-lifetime-infinite-loop-bug.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-async-addr-lifetime-start-bug.ll (+3-3)
  • (modified) llvm/test/Transforms/Coroutines/coro-async-coro-id-async-bug.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-async-declaration.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-async-dyn-align.ll (+3-3)
  • (modified) llvm/test/Transforms/Coroutines/coro-async-end-bug.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-async-no-cse-swift-async-context-addr.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-async-nomerge.ll (+3-3)
  • (modified) llvm/test/Transforms/Coroutines/coro-async-phi.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-async.ll (+12-12)
  • (modified) llvm/test/Transforms/Coroutines/coro-await-suspend-handle-in-ramp.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-await-suspend-lower-invoke.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-await-suspend-lower.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-byval-param.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-catchswitch-cleanuppad.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-catchswitch.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-debug-O2.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-debug-coro-frame.ll (+3-3)
  • (modified) llvm/test/Transforms/Coroutines/coro-debug-dbg.values-not_used_in_frame.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-debug-dbg.values.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-debug-frame-variable.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-debug-spill-dbg.declare.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-debug.ll (+4-4)
  • (modified) llvm/test/Transforms/Coroutines/coro-early-twice.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-eh-aware-edge-split-00.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-eh-aware-edge-split-01.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-eh-aware-edge-split-02.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-frame-arrayalloca.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-frame-reuse-alloca-00.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-frame-reuse-alloca-01.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-frame-reuse-alloca-02.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-frame-reuse-alloca-03.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-frame-reuse-alloca-04.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-frame-reuse-alloca-05.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-frame-unreachable.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-frame.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-lifetime-end.ll (+4-4)
  • (modified) llvm/test/Transforms/Coroutines/coro-materialize.ll (+6-6)
  • (modified) llvm/test/Transforms/Coroutines/coro-noalias-param.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-only-destroy-when-complete.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-padding.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-param-copy.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-readnone-02.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-readnone.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-retcon-alloca-opaque-ptr.ll (+3-3)
  • (modified) llvm/test/Transforms/Coroutines/coro-retcon-alloca.ll (+6-6)
  • (modified) llvm/test/Transforms/Coroutines/coro-retcon-frame.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-retcon-once-private.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-retcon-once-value.ll (+3-3)
  • (modified) llvm/test/Transforms/Coroutines/coro-retcon-once-value2.ll (+4-4)
  • (modified) llvm/test/Transforms/Coroutines/coro-retcon-opaque-ptr.ll (+3-3)
  • (modified) llvm/test/Transforms/Coroutines/coro-retcon-remat.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-retcon-resume-values.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-retcon-resume-values2.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-retcon-unreachable.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-retcon-value.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-retcon.ll (+4-4)
  • (modified) llvm/test/Transforms/Coroutines/coro-spill-after-phi.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-spill-corobegin.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-spill-defs-before-corobegin.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-spill-promise-02.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-spill-promise.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-spill-suspend.ll (+1-1)
  • (modified) llvm/test/Transforms/Coroutines/coro-split-00.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-split-01.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-split-02.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-split-alloc.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-split-dbg-labels.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-split-dbg.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-split-eh-00.ll (+4-3)
  • (modified) llvm/test/Transforms/Coroutines/coro-split-eh-01.ll (+3-3)
  • (modified) llvm/test/Transforms/Coroutines/coro-split-final-suspend.ll (+5-4)
  • (modified) llvm/test/Transforms/Coroutines/coro-split-hidden.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-split-musttail-chain-pgo-counter-promo.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-split-musttail-ppc64le.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-split-musttail.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-split-musttail1.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-split-musttail10.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-split-musttail12.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-split-musttail13.ll (+3-3)
  • (modified) llvm/test/Transforms/Coroutines/coro-split-musttail2.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-split-musttail3.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-split-musttail4.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-split-musttail5.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-split-musttail6.ll (+3-3)
  • (modified) llvm/test/Transforms/Coroutines/coro-split-musttail7.ll (+3-3)
  • (modified) llvm/test/Transforms/Coroutines/coro-split-musttail8.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-split-musttail9.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-split-no-lifetime.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-split-noinline.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-split-sink-lifetime-01.ll (+3-3)
  • (modified) llvm/test/Transforms/Coroutines/coro-split-sink-lifetime-02.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-split-sink-lifetime-03.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-split-sink-lifetime-04.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-swifterror.ll (+3-3)
  • (modified) llvm/test/Transforms/Coroutines/coro-zero-alloca.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/ex0.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/ex1.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/ex2.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/ex3.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/ex4.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/ex5.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/no-suspend.ll (+9-9)
  • (modified) llvm/test/Transforms/Coroutines/phi-coro-end.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/remarks.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/swift-async-dbg.ll (+3-3)
  • (modified) llvm/test/Transforms/FunctionAttrs/noreturn.ll (+2-2)
  • (modified) llvm/test/Transforms/LICM/licm-coroutine.ll (+2-2)
  • (modified) llvm/test/Transforms/LICM/sink-with-coroutine.ll (+4-5)
  • (modified) llvm/unittests/Transforms/Coroutines/ExtraRematTest.cpp (+4-4)
  • (modified) mlir/test/Target/LLVMIR/Import/intrinsic.ll (+2-2)
  • (modified) mlir/test/Target/LLVMIR/llvmir-intrinsics.mlir (+3-3)
diff --git a/clang/lib/CodeGen/CGCoroutine.cpp b/clang/lib/CodeGen/CGCoroutine.cpp
index 827385f9c1a1f..cbc38516a0815 100644
--- a/clang/lib/CodeGen/CGCoroutine.cpp
+++ b/clang/lib/CodeGen/CGCoroutine.cpp
@@ -575,17 +575,19 @@ struct CallCoroEnd final : public EHScopeStack::Cleanup {
     llvm::Function *CoroEndFn = CGM.getIntrinsic(llvm::Intrinsic::coro_end);
     // See if we have a funclet bundle to associate coro.end with. (WinEH)
     auto Bundles = getBundlesForCoroEnd(CGF);
-    auto *CoroEnd =
-      CGF.Builder.CreateCall(CoroEndFn,
-                             {NullPtr, CGF.Builder.getTrue(),
-                              llvm::ConstantTokenNone::get(CoroEndFn->getContext())},
-                             Bundles);
+    CGF.Builder.CreateCall(
+        CoroEndFn,
+        {NullPtr, CGF.Builder.getTrue(),
+         llvm::ConstantTokenNone::get(CoroEndFn->getContext())},
+        Bundles);
     if (Bundles.empty()) {
       // Otherwise, (landingpad model), create a conditional branch that leads
       // either to a cleanup block or a block with EH resume instruction.
       auto *ResumeBB = CGF.getEHResumeBlock(/*isCleanup=*/true);
       auto *CleanupContBB = CGF.createBasicBlock("cleanup.cont");
-      CGF.Builder.CreateCondBr(CoroEnd, ResumeBB, CleanupContBB);
+      auto *CoroWhereFn = CGM.getIntrinsic(llvm::Intrinsic::coro_where);
+      auto *CoroWhere = CGF.Builder.CreateCall(CoroWhereFn);
+      CGF.Builder.CreateCondBr(CoroWhere, ResumeBB, CleanupContBB);
       CGF.EmitBlock(CleanupContBB);
     }
   }
diff --git a/clang/test/CodeGenCoroutines/coro-builtins.c b/clang/test/CodeGenCoroutines/coro-builtins.c
index 79f119b2b60ff..0c2553274f09f 100644
--- a/clang/test/CodeGenCoroutines/coro-builtins.c
+++ b/clang/test/CodeGenCoroutines/coro-builtins.c
@@ -37,7 +37,7 @@ void f(int n) {
   // CHECK-NEXT: call ptr @llvm.coro.free(token %[[COROID]], ptr %[[FRAME]])
   __builtin_coro_free(__builtin_coro_frame());
 
-  // CHECK-NEXT: call i1  @llvm.coro.end(ptr %[[FRAME]], i1 false, token none)
+  // CHECK-NEXT: call void  @llvm.coro.end(ptr %[[FRAME]], i1 false, token none)
   __builtin_coro_end(__builtin_coro_frame(), 0);
 
   // CHECK-NEXT: call i8 @llvm.coro.suspend(token none, i1 true)
diff --git a/clang/test/CodeGenCoroutines/coro-eh-cleanup.cpp b/clang/test/CodeGenCoroutines/coro-eh-cleanup.cpp
index 725cf8faa6b4c..d849ccef17681 100644
--- a/clang/test/CodeGenCoroutines/coro-eh-cleanup.cpp
+++ b/clang/test/CodeGenCoroutines/coro-eh-cleanup.cpp
@@ -60,7 +60,7 @@ coro_t f() {
 
 // CHECK: [[COROENDBB]]:
 // CHECK-NEXT: %[[CLPAD:.+]] = cleanuppad within none
-// CHECK-NEXT: call i1 @llvm.coro.end(ptr null, i1 true, token none) [ "funclet"(token %[[CLPAD]]) ]
+// CHECK-NEXT: call void @llvm.coro.end(ptr null, i1 true, token none) [ "funclet"(token %[[CLPAD]]) ]
 // CHECK-NEXT: cleanupret from %[[CLPAD]] unwind label
 
 // CHECK-LPAD: @_Z1fv(
@@ -76,7 +76,7 @@ coro_t f() {
 // CHECK-LPAD:             to label %{{.+}} unwind label %[[UNWINDBB:.+]]
 
 // CHECK-LPAD: [[UNWINDBB]]:
-// CHECK-LPAD:   %[[I1RESUME:.+]] = call i1 @llvm.coro.end(ptr null, i1 true, token none)
+// CHECK-LPAD:   %[[I1RESUME:.+]] = call i1 @llvm.coro.where()
 // CHECK-LPAD:   br i1  %[[I1RESUME]], label %[[EHRESUME:.+]], label
 // CHECK-LPAD: [[EHRESUME]]:
 // CHECK-LPAD-NEXT:  %[[exn:.+]] = load ptr, ptr %exn.slot, align 8
diff --git a/clang/test/CodeGenCoroutines/coro-lambda.cpp b/clang/test/CodeGenCoroutines/coro-lambda.cpp
index 26c51070f9e2d..b24a190ab41fb 100644
--- a/clang/test/CodeGenCoroutines/coro-lambda.cpp
+++ b/clang/test/CodeGenCoroutines/coro-lambda.cpp
@@ -55,4 +55,4 @@ void f() {
 //   CHECK: alloca %"struct.Task::promise_type"
 //   CHECK: call token @llvm.coro.id(
 //   CHECK: call i8 @llvm.coro.suspend(
-//   CHECK: call i1 @llvm.coro.end(
+//   CHECK: call void @llvm.coro.end(
diff --git a/clang/test/CodeGenCoroutines/coro-params.cpp b/clang/test/CodeGenCoroutines/coro-params.cpp
index 719726cca29c5..79e77a21017fa 100644
--- a/clang/test/CodeGenCoroutines/coro-params.cpp
+++ b/clang/test/CodeGenCoroutines/coro-params.cpp
@@ -117,7 +117,7 @@ void f(int val, MoveOnly moParam, MoveAndCopy mcParam, TrivialABI trivialParam)
   // CHECK-NEXT: call ptr @llvm.coro.free(
 
   // The original trivial_abi parameter is destroyed when returning from the ramp.
-  // CHECK: call i1 @llvm.coro.end
+  // CHECK: call void @llvm.coro.end
   // CHECK: call void @_ZN10TrivialABID1Ev(ptr {{[^,]*}} %[[TrivialAlloca]])
 }
 
@@ -242,6 +242,6 @@ void msabi(MSParm p) {
   co_return;
 
   // The local alloca is used for the destructor call at the end of the ramp.
-  // MSABI: call i1 @llvm.coro.end
+  // MSABI: call void @llvm.coro.end
   // MSABI: call void @"??1MSParm@@QEAA@XZ"(ptr{{.*}} %[[ParamAlloca]])
 }
diff --git a/llvm/docs/Coroutines.rst b/llvm/docs/Coroutines.rst
index dde73c9c3cc23..d9114eb1d1aa6 100644
--- a/llvm/docs/Coroutines.rst
+++ b/llvm/docs/Coroutines.rst
@@ -303,7 +303,7 @@ The LLVM IR for this coroutine looks like this:
     call void @free(ptr %mem)
     br label %suspend
   suspend:
-    %unused = call i1 @llvm.coro.end(ptr %hdl, i1 false, token none)
+    call void @llvm.coro.end(ptr %hdl, i1 false, token none)
     ret ptr %hdl
   }
 
@@ -637,7 +637,7 @@ store the current value produced by a coroutine.
     call void @free(ptr %mem)
     br label %suspend
   suspend:
-    %unused = call i1 @llvm.coro.end(ptr %hdl, i1 false, token none)
+    call void @llvm.coro.end(ptr %hdl, i1 false, token none)
     ret ptr %hdl
   }
 
@@ -806,7 +806,7 @@ The LLVM IR for a coroutine using a Coroutine with a custom ABI looks like:
     call void @free(ptr %mem)
     br label %suspend
   suspend:
-    %unused = call i1 @llvm.coro.end(ptr %hdl, i1 false, token none)
+    call void @llvm.coro.end(ptr %hdl, i1 false, token none)
     ret ptr %hdl
   }
 
@@ -1444,7 +1444,7 @@ A frontend should emit function attribute `presplitcoroutine` for the coroutine.
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 ::
 
-  declare i1 @llvm.coro.end(ptr <handle>, i1 <unwind>, token <result.token>)
+  declare void @llvm.coro.end(ptr <handle>, i1 <unwind>, token <result.token>)
 
 Overview:
 """""""""
@@ -1502,7 +1502,8 @@ For landingpad based exception model, it is expected that frontend uses the
 .. code-block:: llvm
 
     ehcleanup:
-      %InResumePart = call i1 @llvm.coro.end(ptr null, i1 true, token none)
+      call void @llvm.coro.end(ptr null, i1 true, token none)
+      %InResumePart = call i1 @llvm.coro.where()
       br i1 %InResumePart, label %eh.resume, label %cleanup.cont
 
     cleanup.cont:
@@ -1515,7 +1516,7 @@ For landingpad based exception model, it is expected that frontend uses the
       %lpad.val29 = insertvalue { ptr, i32 } %lpad.val, i32 %sel, 1
       resume { ptr, i32 } %lpad.val29
 
-The `CoroSpit` pass replaces `coro.end` with ``True`` in the resume functions,
+The `CoroSpit` pass replaces `coro.where` with ``True`` in the resume functions,
 thus leading to immediate unwind to the caller, whereas in start function it
 is replaced with ``False``, thus allowing to proceed to the rest of the cleanup
 code that is only needed during initial invocation of the coroutine.
@@ -1527,7 +1528,7 @@ referring to an enclosing cleanuppad as follows:
 
     ehcleanup:
       %tok = cleanuppad within none []
-      %unused = call i1 @llvm.coro.end(ptr null, i1 true, token none) [ "funclet"(token %tok) ]
+      call void @llvm.coro.end(ptr null, i1 true, token none) [ "funclet"(token %tok) ]
       cleanupret from %tok unwind label %RestOfTheCleanup
 
 The `CoroSplit` pass, if the funclet bundle is present, will insert
@@ -1592,7 +1593,7 @@ The number of arguments must match the return type of the continuation function:
 
   cleanup:
     %tok = call token (...) @llvm.coro.end.results(i8 %val)
-    call i1 @llvm.coro.end(ptr %hdl, i1 0, token %tok)
+    call void @llvm.coro.end(ptr %hdl, i1 0, token %tok)
     unreachable
 
   ...
@@ -1604,7 +1605,7 @@ The number of arguments must match the return type of the continuation function:
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 ::
 
-  declare i1 @llvm.coro.end.async(ptr <handle>, i1 <unwind>, ...)
+  declare void @llvm.coro.end.async(ptr <handle>, i1 <unwind>, ...)
 
 Overview:
 """""""""
@@ -1635,10 +1636,10 @@ the function call.
 
 .. code-block:: llvm
 
-  call i1 (ptr, i1, ...) @llvm.coro.end.async(
-                           ptr %hdl, i1 0,
-                           ptr @must_tail_call_return,
-                           ptr %ctxt, ptr %task, ptr %actor)
+  call void (ptr, i1, ...) @llvm.coro.end.async(
+                             ptr %hdl, i1 0,
+                             ptr @must_tail_call_return,
+                             ptr %ctxt, ptr %task, ptr %actor)
   unreachable
 
 .. _coro.suspend:
@@ -2117,6 +2118,30 @@ Example:
       %hdl.result = ... ; get address of returned coroutine handle
       ret ptr %hdl.result
 
+'llvm.coro.where' Intrinsic
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+::
+
+  declare i1 @llvm.coro.where()
+
+Overview:
+"""""""""
+
+The '``llvm.coro.where``' intrinsic returns a bool value that marks coroutine resume
+part and start part.
+
+Arguments:
+""""""""""
+
+None
+
+Semantics:
+""""""""""
+
+The `CoroSpit` pass replaces `coro.where` with ``True`` in the resume functions,
+whereas in start function it is replaced with ``False``, thus allowing the frontend
+separate resume part and start part.
+
 Coroutine Transformation Passes
 ===============================
 CoroEarly
diff --git a/llvm/include/llvm/IR/Intrinsics.td b/llvm/include/llvm/IR/Intrinsics.td
index e0ee12391b31d..0d113e0ccb854 100644
--- a/llvm/include/llvm/IR/Intrinsics.td
+++ b/llvm/include/llvm/IR/Intrinsics.td
@@ -1775,12 +1775,13 @@ def int_coro_free : Intrinsic<[llvm_ptr_ty], [llvm_token_ty, llvm_ptr_ty],
                               [IntrReadMem, IntrArgMemOnly,
                                ReadOnly<ArgIndex<1>>,
                                NoCapture<ArgIndex<1>>]>;
-def int_coro_end : Intrinsic<[llvm_i1_ty], [llvm_ptr_ty, llvm_i1_ty, llvm_token_ty], []>;
+def int_coro_end : Intrinsic<[], [llvm_ptr_ty, llvm_i1_ty, llvm_token_ty], []>;
 def int_coro_end_results : Intrinsic<[llvm_token_ty], [llvm_vararg_ty]>;
 def int_coro_end_async
-    : Intrinsic<[llvm_i1_ty], [llvm_ptr_ty, llvm_i1_ty, llvm_vararg_ty], []>;
+    : Intrinsic<[], [llvm_ptr_ty, llvm_i1_ty, llvm_vararg_ty], []>;
 
 def int_coro_frame : Intrinsic<[llvm_ptr_ty], [], [IntrNoMem]>;
+def int_coro_where : Intrinsic<[llvm_i1_ty], [], [IntrNoMem]>;
 def int_coro_noop : Intrinsic<[llvm_ptr_ty], [], [IntrNoMem]>;
 def int_coro_size : Intrinsic<[llvm_anyint_ty], [], [IntrNoMem]>;
 def int_coro_align : Intrinsic<[llvm_anyint_ty], [], [IntrNoMem]>;
diff --git a/llvm/include/llvm/Transforms/Coroutines/CoroInstr.h b/llvm/include/llvm/Transforms/Coroutines/CoroInstr.h
index 0688068167ae6..36ec76c554d50 100644
--- a/llvm/include/llvm/Transforms/Coroutines/CoroInstr.h
+++ b/llvm/include/llvm/Transforms/Coroutines/CoroInstr.h
@@ -428,6 +428,18 @@ class CoroFrameInst : public IntrinsicInst {
   }
 };
 
+/// This represents the llvm.coro.where instruction.
+class CoroWhereInst : public IntrinsicInst {
+public:
+  // Methods to support type inquiry through isa, cast, and dyn_cast:
+  static bool classof(const IntrinsicInst *I) {
+    return I->getIntrinsicID() == Intrinsic::coro_where;
+  }
+  static bool classof(const Value *V) {
+    return isa<IntrinsicInst>(V) && classof(cast<IntrinsicInst>(V));
+  }
+};
+
 /// This represents the llvm.coro.free instruction.
 class CoroFreeInst : public IntrinsicInst {
   enum { IdArg, FrameArg };
diff --git a/llvm/include/llvm/Transforms/Coroutines/CoroShape.h b/llvm/include/llvm/Transforms/Coroutines/CoroShape.h
index c54081de2d9da..83697200e061d 100644
--- a/llvm/include/llvm/Transforms/Coroutines/CoroShape.h
+++ b/llvm/include/llvm/Transforms/Coroutines/CoroShape.h
@@ -53,6 +53,7 @@ enum class ABI {
 struct Shape {
   CoroBeginInst *CoroBegin = nullptr;
   SmallVector<AnyCoroEndInst *, 4> CoroEnds;
+  SmallVector<CoroWhereInst *, 2> CoroWheres;
   SmallVector<CoroSizeInst *, 2> CoroSizes;
   SmallVector<CoroAlignInst *, 2> CoroAligns;
   SmallVector<AnyCoroSuspendInst *, 4> CoroSuspends;
@@ -65,6 +66,7 @@ struct Shape {
   void clear() {
     CoroBegin = nullptr;
     CoroEnds.clear();
+    CoroWheres.clear();
     CoroSizes.clear();
     CoroAligns.clear();
     CoroSuspends.clear();
diff --git a/llvm/lib/Transforms/Coroutines/CoroCleanup.cpp b/llvm/lib/Transforms/Coroutines/CoroCleanup.cpp
index c00e9c7bbee06..65b5a6fc18c0f 100644
--- a/llvm/lib/Transforms/Coroutines/CoroCleanup.cpp
+++ b/llvm/lib/Transforms/Coroutines/CoroCleanup.cpp
@@ -75,8 +75,8 @@ bool Lowerer::lower(Function &F) {
       case Intrinsic::coro_subfn_addr:
         lowerSubFn(Builder, cast<CoroSubFnInst>(II));
         break;
-      case Intrinsic::coro_end:
       case Intrinsic::coro_suspend_retcon:
+      case Intrinsic::coro_where:
         if (IsPrivateAndUnprocessed) {
           II->replaceAllUsesWith(PoisonValue::get(II->getType()));
         } else
diff --git a/llvm/lib/Transforms/Coroutines/CoroCloner.h b/llvm/lib/Transforms/Coroutines/CoroCloner.h
index d1887980fb3bc..78de08879c99e 100644
--- a/llvm/lib/Transforms/Coroutines/CoroCloner.h
+++ b/llvm/lib/Transforms/Coroutines/CoroCloner.h
@@ -120,6 +120,7 @@ class BaseCloner {
   void replaceRetconOrAsyncSuspendUses();
   void replaceCoroSuspends();
   void replaceCoroEnds();
+  void replaceCoroWhere();
   void replaceSwiftErrorOps();
   void salvageDebugInfo();
   void handleFinalSuspend();
diff --git a/llvm/lib/Transforms/Coroutines/CoroSplit.cpp b/llvm/lib/Transforms/Coroutines/CoroSplit.cpp
index 180ac9c61e7df..5961cbf726f1a 100644
--- a/llvm/lib/Transforms/Coroutines/CoroSplit.cpp
+++ b/llvm/lib/Transforms/Coroutines/CoroSplit.cpp
@@ -388,10 +388,6 @@ static void replaceCoroEnd(AnyCoroEndInst *End, const coro::Shape &Shape,
     replaceUnwindCoroEnd(End, Shape, FramePtr, InResume, CG);
   else
     replaceFallthroughCoroEnd(End, Shape, FramePtr, InResume, CG);
-
-  auto &Context = End->getContext();
-  End->replaceAllUsesWith(InResume ? ConstantInt::getTrue(Context)
-                                   : ConstantInt::getFalse(Context));
   End->eraseFromParent();
 }
 
@@ -562,6 +558,15 @@ void coro::BaseCloner::replaceCoroEnds() {
   }
 }
 
+void coro::BaseCloner::replaceCoroWhere() {
+  auto &Ctx = OrigF.getContext();
+  for (auto *CW : Shape.CoroWheres) {
+    auto *NewCW = cast<CoroWhereInst>(VMap[CW]);
+    NewCW->replaceAllUsesWith(ConstantInt::getTrue(Ctx));
+    NewCW->eraseFromParent();
+  }
+}
+
 static void replaceSwiftErrorOps(Function &F, coro::Shape &Shape,
                                  ValueToValueMapTy *VMap) {
   if (Shape.ABI == coro::ABI::Async && Shape.CoroSuspends.empty())
@@ -1077,6 +1082,8 @@ void coro::BaseCloner::create() {
   // Remove coro.end intrinsics.
   replaceCoroEnds();
 
+  replaceCoroWhere();
+
   // Salvage debug info that points into the coroutine frame.
   salvageDebugInfo();
 }
@@ -1951,11 +1958,16 @@ static void removeCoroEndsFromRampFunction(const coro::Shape &Shape) {
       replaceCoroEnd(End, Shape, Shape.FramePtr, /*in resume*/ false, nullptr);
     }
   } else {
-    for (llvm::AnyCoroEndInst *End : Shape.CoroEnds) {
-      auto &Context = End->getContext();
-      End->replaceAllUsesWith(ConstantInt::getFalse(Context));
+    for (llvm::AnyCoroEndInst *End : Shape.CoroEnds)
       End->eraseFromParent();
-    }
+  }
+}
+
+static void removeCoroWhereFromRampFunction(const coro::Shape &Shape) {
+  for (auto *CW : Shape.CoroWheres) {
+    auto &Ctx = CW->getContext();
+    CW->replaceAllUsesWith(ConstantInt::getFalse(Ctx));
+    CW->eraseFromParent();
   }
 }
 
@@ -2020,6 +2032,7 @@ static void doSplitCoroutine(Function &F, SmallVectorImpl<Function *> &Clones,
     coro::salvageDebugInfo(ArgToAllocaMap, *DVR, false /*UseEntryValue*/);
 
   removeCoroEndsFromRampFunction(Shape);
+  removeCoroWhereFromRampFunction(Shape);
 
   if (shouldCreateNoAllocVariant)
     SwitchCoroutineSplitter::createNoAllocVariant(F, Shape, Clones);
diff --git a/llvm/lib/Transforms/Coroutines/Coroutines.cpp b/llvm/lib/Transforms/Coroutines/Coroutines.cpp
index ac93f748ce65c..7c3cbe62ab7b1 100644
--- a/llvm/lib/Transforms/Coroutines/Coroutines.cpp
+++ b/llvm/lib/Transforms/Coroutines/Coroutines.cpp
@@ -93,6 +93,7 @@ static Intrinsic::ID NonOverloadedCoroIntrinsics[] = {
     Intrinsic::coro_save,
     Intrinsic::coro_subfn_addr,
     Intrinsic::coro_suspend,
+    Intrinsic::coro_where,
 };
 
 bool coro::isSuspendBlock(BasicBlock *BB) {
@@ -275,6 +276,9 @@ void coro::Shape::analyze(Function &F,
           }
         }
         break;
+      case Intrinsic::coro_where:
+        CoroWheres.push_back(cast<CoroWhereInst>(II));
+        break;
       case Intrinsic::coro_promise:
         assert(CoroPromise == nullptr &&
                "CoroEarly must ensure coro.promise unique");
diff --git a/llvm/test/Analysis/GlobalsModRef/nonescaping-noalias.ll b/llvm/test/Analysis/GlobalsModRef/nonescaping-noalias.ll
index eed93cf0df8ef..e2eb4f6e7b9e9 100644
--- a/llvm/test/Analysis/GlobalsModRef/nonescaping-noalias.ll
+++ b/llvm/test/Analysis/GlobalsModRef/nonescaping-noalias.ll
@@ -62,7 +62,7 @@ define ptr @test1_tls_noopt(ptr %coro, ptr %param) presplitcoroutine {
 ; CHECK-NEXT:    store i32 [[V]], ptr [[PARAM]], align 4
 ; CHECK-NEXT:    ret ptr [[CORO]]
 ; CHECK:       suspend:
-; CHECK-NEXT:    [[TMP1:%.*]] = call i1 @llvm.coro.end(ptr [[CORO]], i1 false, token none)
+; CHECK-NEXT:    call void @llvm.coro.end(ptr [[CORO]], i1 false, token none)
 ; CHECK-NEXT:    ret ptr [[CORO]]
 ;
 entry:
@@ -79,7 +79,7 @@ resume:
   ret ptr %coro
 
 suspend:
-  call i1 @llvm.coro.end(ptr %coro, i1 0, token none)
+  call void @llvm.coro.end(ptr %coro, i1 0, token none)
   ret ptr %coro
 }
 
diff --git a/llvm/test/Assembler/auto_upgrade_intrinsics.ll b/llvm/test/Assembler/auto_upgrade_intrinsics.ll
index 37cb49650f6bd..64d4a3ba7c802 100644
--- a/llvm/test/Assembler/auto_upgrade_intrinsics.ll
+++ b/llvm/test/Assembler/auto_upgrade_intrinsics.ll
@@ -47,11 +47,11 @@ entry:
   ret void
 }
 
-declare i1 @llvm.coro.end(ptr, i1)
+declare void @llvm.coro.end(ptr, i1)
 define void @test.coro.end(ptr %ptr) {
 ; CHECK-LABEL: @test.coro.end(
-; CHECK: call i1 @llvm.coro.end(ptr %ptr, i1 false, token none)
-  call i1 @llvm.coro.end(ptr %ptr, i1 false)
+; CHECK: call void @llvm.coro.end(ptr %ptr, i1 false, token none)
+  call void @llvm.coro.end(ptr %ptr, i1 false)
   ret void
 }
 
diff --git a/llvm/test/Transforms/Coroutines/ArgAddr.ll b/llvm/test/Transforms/Coroutines/ArgAddr.ll
index ab70836508101..9328c67459077 100644
--- a/llvm/test/Transforms/Coroutines/ArgAddr.ll
+++ b/llvm/test/Transforms/Coroutines/ArgAddr.ll
@@ -45,7 +45,7 @@ coro_Cleanup:
   br label %coro_Suspend
 
 coro_Suspend:
-  call i1 @llvm.coro.end(ptr null, i1 false, token none)
+  call void @llvm.coro.end(ptr null, i1 false, token none)
   ret ptr %1
 }
 
@@ -69,7 +69,7 @@ declare i32 @llvm.coro.size.i32()
 declare ptr @llvm.coro.begin(token, ptr)
 declare i8 @llvm.coro.suspend(token, i1)
 declare ptr @llvm.coro.free(token, ptr)
-declare i1 @llvm.coro.end(ptr, i1, token)
+declare void @llvm.coro.end(ptr, i1, token)
 
 declare void @llvm.coro.resume(ptr)
 declare void @llvm.coro.destroy(ptr)
diff --git a/llvm/test/Transforms/Coroutines/coro-align16.ll b/llvm/test/Transforms/Coroutines/coro-align16.ll
index 39902be9149e8..afdca77e8af3e 100644
--- a/llvm/test/Transforms/Coroutines/coro-align16.ll
+++ b/llvm/test/Transforms/Coroutines/coro-align16.ll
@@ -24,7 +24,7 @@ cleanup:
   br label %suspend
 
 suspend:
-  call i1 @llvm.coro.end(ptr %hdl, i1 0, token none)
+  call void @llvm.coro.end(ptr %hdl, i1 0, token none)
   ret ptr %hdl
 }
 
@@ -44,7 +44,7 @@ declare void @llvm.coro.destroy(ptr)
 declare token @llvm.coro.id(i32, ptr, ptr, ptr)
 declare i1 @llvm.coro.alloc(token)
 declare ptr @llvm.coro.begin(token, ptr)
-declare i1 @llvm.coro.end(ptr, i1, token)
+declare void @llvm.coro.end(ptr, i1, token)
 
 declare void @capture_call(ptr)
 declare void @nocapture_call(ptr nocapture)
diff --git a/llvm/test/Transforms/Coroutines/coro-align32.ll b/llvm/test/Transforms/Coroutines/coro-align32.ll
index 3d910e951259b..9e82ec83011f5 100644
--- a/llvm/test/Transforms/Coroutines/coro-align32.ll
+++ b/llvm/test/Transforms/Coroutines/coro-align32.ll
@@ -28,7 +28,7 @@ cleanup...
[truncated]

@llvmbot
Copy link
Member

llvmbot commented Aug 14, 2025

@llvm/pr-subscribers-clang

Author: Weibo He (NewSigma)

Changes

As mentioned in #151067, current design of llvm.coro.end mixes two functionalities: querying where we are and lowering to some code. This patch separate these functionalities into independent intrinsics by introducing a new intrinsic llvm.coro.where.


Patch is 149.25 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/153404.diff

147 Files Affected:

  • (modified) clang/lib/CodeGen/CGCoroutine.cpp (+8-6)
  • (modified) clang/test/CodeGenCoroutines/coro-builtins.c (+1-1)
  • (modified) clang/test/CodeGenCoroutines/coro-eh-cleanup.cpp (+2-2)
  • (modified) clang/test/CodeGenCoroutines/coro-lambda.cpp (+1-1)
  • (modified) clang/test/CodeGenCoroutines/coro-params.cpp (+2-2)
  • (modified) llvm/docs/Coroutines.rst (+38-13)
  • (modified) llvm/include/llvm/IR/Intrinsics.td (+3-2)
  • (modified) llvm/include/llvm/Transforms/Coroutines/CoroInstr.h (+12)
  • (modified) llvm/include/llvm/Transforms/Coroutines/CoroShape.h (+2)
  • (modified) llvm/lib/Transforms/Coroutines/CoroCleanup.cpp (+1-1)
  • (modified) llvm/lib/Transforms/Coroutines/CoroCloner.h (+1)
  • (modified) llvm/lib/Transforms/Coroutines/CoroSplit.cpp (+21-8)
  • (modified) llvm/lib/Transforms/Coroutines/Coroutines.cpp (+4)
  • (modified) llvm/test/Analysis/GlobalsModRef/nonescaping-noalias.ll (+2-2)
  • (modified) llvm/test/Assembler/auto_upgrade_intrinsics.ll (+3-3)
  • (modified) llvm/test/Transforms/Coroutines/ArgAddr.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-align16.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-align32.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-align64-02.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-align64.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-align8-02.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-align8.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-alloc-with-param-O0.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-alloc-with-param-O2.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-alloca-01.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-alloca-02.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-alloca-03.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-alloca-04.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-alloca-05.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-alloca-06.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-alloca-07.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-alloca-08.ll (+3-3)
  • (modified) llvm/test/Transforms/Coroutines/coro-alloca-loop-carried-address.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-alloca-outside-frame.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-alloca-with-addrspace.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-async-addr-lifetime-infinite-loop-bug.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-async-addr-lifetime-start-bug.ll (+3-3)
  • (modified) llvm/test/Transforms/Coroutines/coro-async-coro-id-async-bug.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-async-declaration.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-async-dyn-align.ll (+3-3)
  • (modified) llvm/test/Transforms/Coroutines/coro-async-end-bug.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-async-no-cse-swift-async-context-addr.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-async-nomerge.ll (+3-3)
  • (modified) llvm/test/Transforms/Coroutines/coro-async-phi.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-async.ll (+12-12)
  • (modified) llvm/test/Transforms/Coroutines/coro-await-suspend-handle-in-ramp.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-await-suspend-lower-invoke.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-await-suspend-lower.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-byval-param.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-catchswitch-cleanuppad.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-catchswitch.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-debug-O2.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-debug-coro-frame.ll (+3-3)
  • (modified) llvm/test/Transforms/Coroutines/coro-debug-dbg.values-not_used_in_frame.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-debug-dbg.values.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-debug-frame-variable.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-debug-spill-dbg.declare.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-debug.ll (+4-4)
  • (modified) llvm/test/Transforms/Coroutines/coro-early-twice.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-eh-aware-edge-split-00.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-eh-aware-edge-split-01.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-eh-aware-edge-split-02.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-frame-arrayalloca.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-frame-reuse-alloca-00.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-frame-reuse-alloca-01.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-frame-reuse-alloca-02.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-frame-reuse-alloca-03.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-frame-reuse-alloca-04.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-frame-reuse-alloca-05.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-frame-unreachable.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-frame.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-lifetime-end.ll (+4-4)
  • (modified) llvm/test/Transforms/Coroutines/coro-materialize.ll (+6-6)
  • (modified) llvm/test/Transforms/Coroutines/coro-noalias-param.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-only-destroy-when-complete.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-padding.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-param-copy.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-readnone-02.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-readnone.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-retcon-alloca-opaque-ptr.ll (+3-3)
  • (modified) llvm/test/Transforms/Coroutines/coro-retcon-alloca.ll (+6-6)
  • (modified) llvm/test/Transforms/Coroutines/coro-retcon-frame.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-retcon-once-private.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-retcon-once-value.ll (+3-3)
  • (modified) llvm/test/Transforms/Coroutines/coro-retcon-once-value2.ll (+4-4)
  • (modified) llvm/test/Transforms/Coroutines/coro-retcon-opaque-ptr.ll (+3-3)
  • (modified) llvm/test/Transforms/Coroutines/coro-retcon-remat.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-retcon-resume-values.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-retcon-resume-values2.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-retcon-unreachable.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-retcon-value.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-retcon.ll (+4-4)
  • (modified) llvm/test/Transforms/Coroutines/coro-spill-after-phi.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-spill-corobegin.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-spill-defs-before-corobegin.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-spill-promise-02.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-spill-promise.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-spill-suspend.ll (+1-1)
  • (modified) llvm/test/Transforms/Coroutines/coro-split-00.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-split-01.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-split-02.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-split-alloc.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-split-dbg-labels.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-split-dbg.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-split-eh-00.ll (+4-3)
  • (modified) llvm/test/Transforms/Coroutines/coro-split-eh-01.ll (+3-3)
  • (modified) llvm/test/Transforms/Coroutines/coro-split-final-suspend.ll (+5-4)
  • (modified) llvm/test/Transforms/Coroutines/coro-split-hidden.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-split-musttail-chain-pgo-counter-promo.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-split-musttail-ppc64le.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-split-musttail.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-split-musttail1.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-split-musttail10.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-split-musttail12.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-split-musttail13.ll (+3-3)
  • (modified) llvm/test/Transforms/Coroutines/coro-split-musttail2.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-split-musttail3.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-split-musttail4.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-split-musttail5.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-split-musttail6.ll (+3-3)
  • (modified) llvm/test/Transforms/Coroutines/coro-split-musttail7.ll (+3-3)
  • (modified) llvm/test/Transforms/Coroutines/coro-split-musttail8.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-split-musttail9.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-split-no-lifetime.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-split-noinline.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-split-sink-lifetime-01.ll (+3-3)
  • (modified) llvm/test/Transforms/Coroutines/coro-split-sink-lifetime-02.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-split-sink-lifetime-03.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-split-sink-lifetime-04.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/coro-swifterror.ll (+3-3)
  • (modified) llvm/test/Transforms/Coroutines/coro-zero-alloca.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/ex0.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/ex1.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/ex2.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/ex3.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/ex4.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/ex5.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/no-suspend.ll (+9-9)
  • (modified) llvm/test/Transforms/Coroutines/phi-coro-end.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/remarks.ll (+2-2)
  • (modified) llvm/test/Transforms/Coroutines/swift-async-dbg.ll (+3-3)
  • (modified) llvm/test/Transforms/FunctionAttrs/noreturn.ll (+2-2)
  • (modified) llvm/test/Transforms/LICM/licm-coroutine.ll (+2-2)
  • (modified) llvm/test/Transforms/LICM/sink-with-coroutine.ll (+4-5)
  • (modified) llvm/unittests/Transforms/Coroutines/ExtraRematTest.cpp (+4-4)
  • (modified) mlir/test/Target/LLVMIR/Import/intrinsic.ll (+2-2)
  • (modified) mlir/test/Target/LLVMIR/llvmir-intrinsics.mlir (+3-3)
diff --git a/clang/lib/CodeGen/CGCoroutine.cpp b/clang/lib/CodeGen/CGCoroutine.cpp
index 827385f9c1a1f..cbc38516a0815 100644
--- a/clang/lib/CodeGen/CGCoroutine.cpp
+++ b/clang/lib/CodeGen/CGCoroutine.cpp
@@ -575,17 +575,19 @@ struct CallCoroEnd final : public EHScopeStack::Cleanup {
     llvm::Function *CoroEndFn = CGM.getIntrinsic(llvm::Intrinsic::coro_end);
     // See if we have a funclet bundle to associate coro.end with. (WinEH)
     auto Bundles = getBundlesForCoroEnd(CGF);
-    auto *CoroEnd =
-      CGF.Builder.CreateCall(CoroEndFn,
-                             {NullPtr, CGF.Builder.getTrue(),
-                              llvm::ConstantTokenNone::get(CoroEndFn->getContext())},
-                             Bundles);
+    CGF.Builder.CreateCall(
+        CoroEndFn,
+        {NullPtr, CGF.Builder.getTrue(),
+         llvm::ConstantTokenNone::get(CoroEndFn->getContext())},
+        Bundles);
     if (Bundles.empty()) {
       // Otherwise, (landingpad model), create a conditional branch that leads
       // either to a cleanup block or a block with EH resume instruction.
       auto *ResumeBB = CGF.getEHResumeBlock(/*isCleanup=*/true);
       auto *CleanupContBB = CGF.createBasicBlock("cleanup.cont");
-      CGF.Builder.CreateCondBr(CoroEnd, ResumeBB, CleanupContBB);
+      auto *CoroWhereFn = CGM.getIntrinsic(llvm::Intrinsic::coro_where);
+      auto *CoroWhere = CGF.Builder.CreateCall(CoroWhereFn);
+      CGF.Builder.CreateCondBr(CoroWhere, ResumeBB, CleanupContBB);
       CGF.EmitBlock(CleanupContBB);
     }
   }
diff --git a/clang/test/CodeGenCoroutines/coro-builtins.c b/clang/test/CodeGenCoroutines/coro-builtins.c
index 79f119b2b60ff..0c2553274f09f 100644
--- a/clang/test/CodeGenCoroutines/coro-builtins.c
+++ b/clang/test/CodeGenCoroutines/coro-builtins.c
@@ -37,7 +37,7 @@ void f(int n) {
   // CHECK-NEXT: call ptr @llvm.coro.free(token %[[COROID]], ptr %[[FRAME]])
   __builtin_coro_free(__builtin_coro_frame());
 
-  // CHECK-NEXT: call i1  @llvm.coro.end(ptr %[[FRAME]], i1 false, token none)
+  // CHECK-NEXT: call void  @llvm.coro.end(ptr %[[FRAME]], i1 false, token none)
   __builtin_coro_end(__builtin_coro_frame(), 0);
 
   // CHECK-NEXT: call i8 @llvm.coro.suspend(token none, i1 true)
diff --git a/clang/test/CodeGenCoroutines/coro-eh-cleanup.cpp b/clang/test/CodeGenCoroutines/coro-eh-cleanup.cpp
index 725cf8faa6b4c..d849ccef17681 100644
--- a/clang/test/CodeGenCoroutines/coro-eh-cleanup.cpp
+++ b/clang/test/CodeGenCoroutines/coro-eh-cleanup.cpp
@@ -60,7 +60,7 @@ coro_t f() {
 
 // CHECK: [[COROENDBB]]:
 // CHECK-NEXT: %[[CLPAD:.+]] = cleanuppad within none
-// CHECK-NEXT: call i1 @llvm.coro.end(ptr null, i1 true, token none) [ "funclet"(token %[[CLPAD]]) ]
+// CHECK-NEXT: call void @llvm.coro.end(ptr null, i1 true, token none) [ "funclet"(token %[[CLPAD]]) ]
 // CHECK-NEXT: cleanupret from %[[CLPAD]] unwind label
 
 // CHECK-LPAD: @_Z1fv(
@@ -76,7 +76,7 @@ coro_t f() {
 // CHECK-LPAD:             to label %{{.+}} unwind label %[[UNWINDBB:.+]]
 
 // CHECK-LPAD: [[UNWINDBB]]:
-// CHECK-LPAD:   %[[I1RESUME:.+]] = call i1 @llvm.coro.end(ptr null, i1 true, token none)
+// CHECK-LPAD:   %[[I1RESUME:.+]] = call i1 @llvm.coro.where()
 // CHECK-LPAD:   br i1  %[[I1RESUME]], label %[[EHRESUME:.+]], label
 // CHECK-LPAD: [[EHRESUME]]:
 // CHECK-LPAD-NEXT:  %[[exn:.+]] = load ptr, ptr %exn.slot, align 8
diff --git a/clang/test/CodeGenCoroutines/coro-lambda.cpp b/clang/test/CodeGenCoroutines/coro-lambda.cpp
index 26c51070f9e2d..b24a190ab41fb 100644
--- a/clang/test/CodeGenCoroutines/coro-lambda.cpp
+++ b/clang/test/CodeGenCoroutines/coro-lambda.cpp
@@ -55,4 +55,4 @@ void f() {
 //   CHECK: alloca %"struct.Task::promise_type"
 //   CHECK: call token @llvm.coro.id(
 //   CHECK: call i8 @llvm.coro.suspend(
-//   CHECK: call i1 @llvm.coro.end(
+//   CHECK: call void @llvm.coro.end(
diff --git a/clang/test/CodeGenCoroutines/coro-params.cpp b/clang/test/CodeGenCoroutines/coro-params.cpp
index 719726cca29c5..79e77a21017fa 100644
--- a/clang/test/CodeGenCoroutines/coro-params.cpp
+++ b/clang/test/CodeGenCoroutines/coro-params.cpp
@@ -117,7 +117,7 @@ void f(int val, MoveOnly moParam, MoveAndCopy mcParam, TrivialABI trivialParam)
   // CHECK-NEXT: call ptr @llvm.coro.free(
 
   // The original trivial_abi parameter is destroyed when returning from the ramp.
-  // CHECK: call i1 @llvm.coro.end
+  // CHECK: call void @llvm.coro.end
   // CHECK: call void @_ZN10TrivialABID1Ev(ptr {{[^,]*}} %[[TrivialAlloca]])
 }
 
@@ -242,6 +242,6 @@ void msabi(MSParm p) {
   co_return;
 
   // The local alloca is used for the destructor call at the end of the ramp.
-  // MSABI: call i1 @llvm.coro.end
+  // MSABI: call void @llvm.coro.end
   // MSABI: call void @"??1MSParm@@QEAA@XZ"(ptr{{.*}} %[[ParamAlloca]])
 }
diff --git a/llvm/docs/Coroutines.rst b/llvm/docs/Coroutines.rst
index dde73c9c3cc23..d9114eb1d1aa6 100644
--- a/llvm/docs/Coroutines.rst
+++ b/llvm/docs/Coroutines.rst
@@ -303,7 +303,7 @@ The LLVM IR for this coroutine looks like this:
     call void @free(ptr %mem)
     br label %suspend
   suspend:
-    %unused = call i1 @llvm.coro.end(ptr %hdl, i1 false, token none)
+    call void @llvm.coro.end(ptr %hdl, i1 false, token none)
     ret ptr %hdl
   }
 
@@ -637,7 +637,7 @@ store the current value produced by a coroutine.
     call void @free(ptr %mem)
     br label %suspend
   suspend:
-    %unused = call i1 @llvm.coro.end(ptr %hdl, i1 false, token none)
+    call void @llvm.coro.end(ptr %hdl, i1 false, token none)
     ret ptr %hdl
   }
 
@@ -806,7 +806,7 @@ The LLVM IR for a coroutine using a Coroutine with a custom ABI looks like:
     call void @free(ptr %mem)
     br label %suspend
   suspend:
-    %unused = call i1 @llvm.coro.end(ptr %hdl, i1 false, token none)
+    call void @llvm.coro.end(ptr %hdl, i1 false, token none)
     ret ptr %hdl
   }
 
@@ -1444,7 +1444,7 @@ A frontend should emit function attribute `presplitcoroutine` for the coroutine.
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 ::
 
-  declare i1 @llvm.coro.end(ptr <handle>, i1 <unwind>, token <result.token>)
+  declare void @llvm.coro.end(ptr <handle>, i1 <unwind>, token <result.token>)
 
 Overview:
 """""""""
@@ -1502,7 +1502,8 @@ For landingpad based exception model, it is expected that frontend uses the
 .. code-block:: llvm
 
     ehcleanup:
-      %InResumePart = call i1 @llvm.coro.end(ptr null, i1 true, token none)
+      call void @llvm.coro.end(ptr null, i1 true, token none)
+      %InResumePart = call i1 @llvm.coro.where()
       br i1 %InResumePart, label %eh.resume, label %cleanup.cont
 
     cleanup.cont:
@@ -1515,7 +1516,7 @@ For landingpad based exception model, it is expected that frontend uses the
       %lpad.val29 = insertvalue { ptr, i32 } %lpad.val, i32 %sel, 1
       resume { ptr, i32 } %lpad.val29
 
-The `CoroSpit` pass replaces `coro.end` with ``True`` in the resume functions,
+The `CoroSpit` pass replaces `coro.where` with ``True`` in the resume functions,
 thus leading to immediate unwind to the caller, whereas in start function it
 is replaced with ``False``, thus allowing to proceed to the rest of the cleanup
 code that is only needed during initial invocation of the coroutine.
@@ -1527,7 +1528,7 @@ referring to an enclosing cleanuppad as follows:
 
     ehcleanup:
       %tok = cleanuppad within none []
-      %unused = call i1 @llvm.coro.end(ptr null, i1 true, token none) [ "funclet"(token %tok) ]
+      call void @llvm.coro.end(ptr null, i1 true, token none) [ "funclet"(token %tok) ]
       cleanupret from %tok unwind label %RestOfTheCleanup
 
 The `CoroSplit` pass, if the funclet bundle is present, will insert
@@ -1592,7 +1593,7 @@ The number of arguments must match the return type of the continuation function:
 
   cleanup:
     %tok = call token (...) @llvm.coro.end.results(i8 %val)
-    call i1 @llvm.coro.end(ptr %hdl, i1 0, token %tok)
+    call void @llvm.coro.end(ptr %hdl, i1 0, token %tok)
     unreachable
 
   ...
@@ -1604,7 +1605,7 @@ The number of arguments must match the return type of the continuation function:
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 ::
 
-  declare i1 @llvm.coro.end.async(ptr <handle>, i1 <unwind>, ...)
+  declare void @llvm.coro.end.async(ptr <handle>, i1 <unwind>, ...)
 
 Overview:
 """""""""
@@ -1635,10 +1636,10 @@ the function call.
 
 .. code-block:: llvm
 
-  call i1 (ptr, i1, ...) @llvm.coro.end.async(
-                           ptr %hdl, i1 0,
-                           ptr @must_tail_call_return,
-                           ptr %ctxt, ptr %task, ptr %actor)
+  call void (ptr, i1, ...) @llvm.coro.end.async(
+                             ptr %hdl, i1 0,
+                             ptr @must_tail_call_return,
+                             ptr %ctxt, ptr %task, ptr %actor)
   unreachable
 
 .. _coro.suspend:
@@ -2117,6 +2118,30 @@ Example:
       %hdl.result = ... ; get address of returned coroutine handle
       ret ptr %hdl.result
 
+'llvm.coro.where' Intrinsic
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+::
+
+  declare i1 @llvm.coro.where()
+
+Overview:
+"""""""""
+
+The '``llvm.coro.where``' intrinsic returns a bool value that marks coroutine resume
+part and start part.
+
+Arguments:
+""""""""""
+
+None
+
+Semantics:
+""""""""""
+
+The `CoroSpit` pass replaces `coro.where` with ``True`` in the resume functions,
+whereas in start function it is replaced with ``False``, thus allowing the frontend
+separate resume part and start part.
+
 Coroutine Transformation Passes
 ===============================
 CoroEarly
diff --git a/llvm/include/llvm/IR/Intrinsics.td b/llvm/include/llvm/IR/Intrinsics.td
index e0ee12391b31d..0d113e0ccb854 100644
--- a/llvm/include/llvm/IR/Intrinsics.td
+++ b/llvm/include/llvm/IR/Intrinsics.td
@@ -1775,12 +1775,13 @@ def int_coro_free : Intrinsic<[llvm_ptr_ty], [llvm_token_ty, llvm_ptr_ty],
                               [IntrReadMem, IntrArgMemOnly,
                                ReadOnly<ArgIndex<1>>,
                                NoCapture<ArgIndex<1>>]>;
-def int_coro_end : Intrinsic<[llvm_i1_ty], [llvm_ptr_ty, llvm_i1_ty, llvm_token_ty], []>;
+def int_coro_end : Intrinsic<[], [llvm_ptr_ty, llvm_i1_ty, llvm_token_ty], []>;
 def int_coro_end_results : Intrinsic<[llvm_token_ty], [llvm_vararg_ty]>;
 def int_coro_end_async
-    : Intrinsic<[llvm_i1_ty], [llvm_ptr_ty, llvm_i1_ty, llvm_vararg_ty], []>;
+    : Intrinsic<[], [llvm_ptr_ty, llvm_i1_ty, llvm_vararg_ty], []>;
 
 def int_coro_frame : Intrinsic<[llvm_ptr_ty], [], [IntrNoMem]>;
+def int_coro_where : Intrinsic<[llvm_i1_ty], [], [IntrNoMem]>;
 def int_coro_noop : Intrinsic<[llvm_ptr_ty], [], [IntrNoMem]>;
 def int_coro_size : Intrinsic<[llvm_anyint_ty], [], [IntrNoMem]>;
 def int_coro_align : Intrinsic<[llvm_anyint_ty], [], [IntrNoMem]>;
diff --git a/llvm/include/llvm/Transforms/Coroutines/CoroInstr.h b/llvm/include/llvm/Transforms/Coroutines/CoroInstr.h
index 0688068167ae6..36ec76c554d50 100644
--- a/llvm/include/llvm/Transforms/Coroutines/CoroInstr.h
+++ b/llvm/include/llvm/Transforms/Coroutines/CoroInstr.h
@@ -428,6 +428,18 @@ class CoroFrameInst : public IntrinsicInst {
   }
 };
 
+/// This represents the llvm.coro.where instruction.
+class CoroWhereInst : public IntrinsicInst {
+public:
+  // Methods to support type inquiry through isa, cast, and dyn_cast:
+  static bool classof(const IntrinsicInst *I) {
+    return I->getIntrinsicID() == Intrinsic::coro_where;
+  }
+  static bool classof(const Value *V) {
+    return isa<IntrinsicInst>(V) && classof(cast<IntrinsicInst>(V));
+  }
+};
+
 /// This represents the llvm.coro.free instruction.
 class CoroFreeInst : public IntrinsicInst {
   enum { IdArg, FrameArg };
diff --git a/llvm/include/llvm/Transforms/Coroutines/CoroShape.h b/llvm/include/llvm/Transforms/Coroutines/CoroShape.h
index c54081de2d9da..83697200e061d 100644
--- a/llvm/include/llvm/Transforms/Coroutines/CoroShape.h
+++ b/llvm/include/llvm/Transforms/Coroutines/CoroShape.h
@@ -53,6 +53,7 @@ enum class ABI {
 struct Shape {
   CoroBeginInst *CoroBegin = nullptr;
   SmallVector<AnyCoroEndInst *, 4> CoroEnds;
+  SmallVector<CoroWhereInst *, 2> CoroWheres;
   SmallVector<CoroSizeInst *, 2> CoroSizes;
   SmallVector<CoroAlignInst *, 2> CoroAligns;
   SmallVector<AnyCoroSuspendInst *, 4> CoroSuspends;
@@ -65,6 +66,7 @@ struct Shape {
   void clear() {
     CoroBegin = nullptr;
     CoroEnds.clear();
+    CoroWheres.clear();
     CoroSizes.clear();
     CoroAligns.clear();
     CoroSuspends.clear();
diff --git a/llvm/lib/Transforms/Coroutines/CoroCleanup.cpp b/llvm/lib/Transforms/Coroutines/CoroCleanup.cpp
index c00e9c7bbee06..65b5a6fc18c0f 100644
--- a/llvm/lib/Transforms/Coroutines/CoroCleanup.cpp
+++ b/llvm/lib/Transforms/Coroutines/CoroCleanup.cpp
@@ -75,8 +75,8 @@ bool Lowerer::lower(Function &F) {
       case Intrinsic::coro_subfn_addr:
         lowerSubFn(Builder, cast<CoroSubFnInst>(II));
         break;
-      case Intrinsic::coro_end:
       case Intrinsic::coro_suspend_retcon:
+      case Intrinsic::coro_where:
         if (IsPrivateAndUnprocessed) {
           II->replaceAllUsesWith(PoisonValue::get(II->getType()));
         } else
diff --git a/llvm/lib/Transforms/Coroutines/CoroCloner.h b/llvm/lib/Transforms/Coroutines/CoroCloner.h
index d1887980fb3bc..78de08879c99e 100644
--- a/llvm/lib/Transforms/Coroutines/CoroCloner.h
+++ b/llvm/lib/Transforms/Coroutines/CoroCloner.h
@@ -120,6 +120,7 @@ class BaseCloner {
   void replaceRetconOrAsyncSuspendUses();
   void replaceCoroSuspends();
   void replaceCoroEnds();
+  void replaceCoroWhere();
   void replaceSwiftErrorOps();
   void salvageDebugInfo();
   void handleFinalSuspend();
diff --git a/llvm/lib/Transforms/Coroutines/CoroSplit.cpp b/llvm/lib/Transforms/Coroutines/CoroSplit.cpp
index 180ac9c61e7df..5961cbf726f1a 100644
--- a/llvm/lib/Transforms/Coroutines/CoroSplit.cpp
+++ b/llvm/lib/Transforms/Coroutines/CoroSplit.cpp
@@ -388,10 +388,6 @@ static void replaceCoroEnd(AnyCoroEndInst *End, const coro::Shape &Shape,
     replaceUnwindCoroEnd(End, Shape, FramePtr, InResume, CG);
   else
     replaceFallthroughCoroEnd(End, Shape, FramePtr, InResume, CG);
-
-  auto &Context = End->getContext();
-  End->replaceAllUsesWith(InResume ? ConstantInt::getTrue(Context)
-                                   : ConstantInt::getFalse(Context));
   End->eraseFromParent();
 }
 
@@ -562,6 +558,15 @@ void coro::BaseCloner::replaceCoroEnds() {
   }
 }
 
+void coro::BaseCloner::replaceCoroWhere() {
+  auto &Ctx = OrigF.getContext();
+  for (auto *CW : Shape.CoroWheres) {
+    auto *NewCW = cast<CoroWhereInst>(VMap[CW]);
+    NewCW->replaceAllUsesWith(ConstantInt::getTrue(Ctx));
+    NewCW->eraseFromParent();
+  }
+}
+
 static void replaceSwiftErrorOps(Function &F, coro::Shape &Shape,
                                  ValueToValueMapTy *VMap) {
   if (Shape.ABI == coro::ABI::Async && Shape.CoroSuspends.empty())
@@ -1077,6 +1082,8 @@ void coro::BaseCloner::create() {
   // Remove coro.end intrinsics.
   replaceCoroEnds();
 
+  replaceCoroWhere();
+
   // Salvage debug info that points into the coroutine frame.
   salvageDebugInfo();
 }
@@ -1951,11 +1958,16 @@ static void removeCoroEndsFromRampFunction(const coro::Shape &Shape) {
       replaceCoroEnd(End, Shape, Shape.FramePtr, /*in resume*/ false, nullptr);
     }
   } else {
-    for (llvm::AnyCoroEndInst *End : Shape.CoroEnds) {
-      auto &Context = End->getContext();
-      End->replaceAllUsesWith(ConstantInt::getFalse(Context));
+    for (llvm::AnyCoroEndInst *End : Shape.CoroEnds)
       End->eraseFromParent();
-    }
+  }
+}
+
+static void removeCoroWhereFromRampFunction(const coro::Shape &Shape) {
+  for (auto *CW : Shape.CoroWheres) {
+    auto &Ctx = CW->getContext();
+    CW->replaceAllUsesWith(ConstantInt::getFalse(Ctx));
+    CW->eraseFromParent();
   }
 }
 
@@ -2020,6 +2032,7 @@ static void doSplitCoroutine(Function &F, SmallVectorImpl<Function *> &Clones,
     coro::salvageDebugInfo(ArgToAllocaMap, *DVR, false /*UseEntryValue*/);
 
   removeCoroEndsFromRampFunction(Shape);
+  removeCoroWhereFromRampFunction(Shape);
 
   if (shouldCreateNoAllocVariant)
     SwitchCoroutineSplitter::createNoAllocVariant(F, Shape, Clones);
diff --git a/llvm/lib/Transforms/Coroutines/Coroutines.cpp b/llvm/lib/Transforms/Coroutines/Coroutines.cpp
index ac93f748ce65c..7c3cbe62ab7b1 100644
--- a/llvm/lib/Transforms/Coroutines/Coroutines.cpp
+++ b/llvm/lib/Transforms/Coroutines/Coroutines.cpp
@@ -93,6 +93,7 @@ static Intrinsic::ID NonOverloadedCoroIntrinsics[] = {
     Intrinsic::coro_save,
     Intrinsic::coro_subfn_addr,
     Intrinsic::coro_suspend,
+    Intrinsic::coro_where,
 };
 
 bool coro::isSuspendBlock(BasicBlock *BB) {
@@ -275,6 +276,9 @@ void coro::Shape::analyze(Function &F,
           }
         }
         break;
+      case Intrinsic::coro_where:
+        CoroWheres.push_back(cast<CoroWhereInst>(II));
+        break;
       case Intrinsic::coro_promise:
         assert(CoroPromise == nullptr &&
                "CoroEarly must ensure coro.promise unique");
diff --git a/llvm/test/Analysis/GlobalsModRef/nonescaping-noalias.ll b/llvm/test/Analysis/GlobalsModRef/nonescaping-noalias.ll
index eed93cf0df8ef..e2eb4f6e7b9e9 100644
--- a/llvm/test/Analysis/GlobalsModRef/nonescaping-noalias.ll
+++ b/llvm/test/Analysis/GlobalsModRef/nonescaping-noalias.ll
@@ -62,7 +62,7 @@ define ptr @test1_tls_noopt(ptr %coro, ptr %param) presplitcoroutine {
 ; CHECK-NEXT:    store i32 [[V]], ptr [[PARAM]], align 4
 ; CHECK-NEXT:    ret ptr [[CORO]]
 ; CHECK:       suspend:
-; CHECK-NEXT:    [[TMP1:%.*]] = call i1 @llvm.coro.end(ptr [[CORO]], i1 false, token none)
+; CHECK-NEXT:    call void @llvm.coro.end(ptr [[CORO]], i1 false, token none)
 ; CHECK-NEXT:    ret ptr [[CORO]]
 ;
 entry:
@@ -79,7 +79,7 @@ resume:
   ret ptr %coro
 
 suspend:
-  call i1 @llvm.coro.end(ptr %coro, i1 0, token none)
+  call void @llvm.coro.end(ptr %coro, i1 0, token none)
   ret ptr %coro
 }
 
diff --git a/llvm/test/Assembler/auto_upgrade_intrinsics.ll b/llvm/test/Assembler/auto_upgrade_intrinsics.ll
index 37cb49650f6bd..64d4a3ba7c802 100644
--- a/llvm/test/Assembler/auto_upgrade_intrinsics.ll
+++ b/llvm/test/Assembler/auto_upgrade_intrinsics.ll
@@ -47,11 +47,11 @@ entry:
   ret void
 }
 
-declare i1 @llvm.coro.end(ptr, i1)
+declare void @llvm.coro.end(ptr, i1)
 define void @test.coro.end(ptr %ptr) {
 ; CHECK-LABEL: @test.coro.end(
-; CHECK: call i1 @llvm.coro.end(ptr %ptr, i1 false, token none)
-  call i1 @llvm.coro.end(ptr %ptr, i1 false)
+; CHECK: call void @llvm.coro.end(ptr %ptr, i1 false, token none)
+  call void @llvm.coro.end(ptr %ptr, i1 false)
   ret void
 }
 
diff --git a/llvm/test/Transforms/Coroutines/ArgAddr.ll b/llvm/test/Transforms/Coroutines/ArgAddr.ll
index ab70836508101..9328c67459077 100644
--- a/llvm/test/Transforms/Coroutines/ArgAddr.ll
+++ b/llvm/test/Transforms/Coroutines/ArgAddr.ll
@@ -45,7 +45,7 @@ coro_Cleanup:
   br label %coro_Suspend
 
 coro_Suspend:
-  call i1 @llvm.coro.end(ptr null, i1 false, token none)
+  call void @llvm.coro.end(ptr null, i1 false, token none)
   ret ptr %1
 }
 
@@ -69,7 +69,7 @@ declare i32 @llvm.coro.size.i32()
 declare ptr @llvm.coro.begin(token, ptr)
 declare i8 @llvm.coro.suspend(token, i1)
 declare ptr @llvm.coro.free(token, ptr)
-declare i1 @llvm.coro.end(ptr, i1, token)
+declare void @llvm.coro.end(ptr, i1, token)
 
 declare void @llvm.coro.resume(ptr)
 declare void @llvm.coro.destroy(ptr)
diff --git a/llvm/test/Transforms/Coroutines/coro-align16.ll b/llvm/test/Transforms/Coroutines/coro-align16.ll
index 39902be9149e8..afdca77e8af3e 100644
--- a/llvm/test/Transforms/Coroutines/coro-align16.ll
+++ b/llvm/test/Transforms/Coroutines/coro-align16.ll
@@ -24,7 +24,7 @@ cleanup:
   br label %suspend
 
 suspend:
-  call i1 @llvm.coro.end(ptr %hdl, i1 0, token none)
+  call void @llvm.coro.end(ptr %hdl, i1 0, token none)
   ret ptr %hdl
 }
 
@@ -44,7 +44,7 @@ declare void @llvm.coro.destroy(ptr)
 declare token @llvm.coro.id(i32, ptr, ptr, ptr)
 declare i1 @llvm.coro.alloc(token)
 declare ptr @llvm.coro.begin(token, ptr)
-declare i1 @llvm.coro.end(ptr, i1, token)
+declare void @llvm.coro.end(ptr, i1, token)
 
 declare void @capture_call(ptr)
 declare void @nocapture_call(ptr nocapture)
diff --git a/llvm/test/Transforms/Coroutines/coro-align32.ll b/llvm/test/Transforms/Coroutines/coro-align32.ll
index 3d910e951259b..9e82ec83011f5 100644
--- a/llvm/test/Transforms/Coroutines/coro-align32.ll
+++ b/llvm/test/Transforms/Coroutines/coro-align32.ll
@@ -28,7 +28,7 @@ cleanup...
[truncated]

Copy link
Member

@ChuanqiXu9 ChuanqiXu9 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did a quick scanning. It looks good generally.

@NewSigma NewSigma changed the title [Coroutines] Add llvm.coro.where and drop return value of llvm.coro.end [Coroutines] Add llvm.coro.is_in_ramp and drop return value of llvm.coro.end Aug 15, 2025
@NewSigma NewSigma requested a review from ChuanqiXu9 August 25, 2025 01:13
@NewSigma
Copy link
Contributor Author

Thanks for the code review, @ChuanqiXu9. Would you mind helping to merge it if it's okay?

@ChuanqiXu9
Copy link
Member

I reverted it as the failure seems relevent.

@llvm-ci
Copy link
Collaborator

llvm-ci commented Aug 25, 2025

LLVM Buildbot has detected a new failure on builder openmp-offload-sles-build-only running on rocm-worker-hw-04-sles while building clang,llvm,mlir at step 9 "Add check check-llvm".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/140/builds/29481

Here is the relevant piece of the build log for the reference
Step 9 (Add check check-llvm) failure: test (failure)
******************** TEST 'LLVM :: Instrumentation/AddressSanitizer/coro-byval-param.ll' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/bin/opt < /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/llvm/test/Instrumentation/AddressSanitizer/coro-byval-param.ll -passes='asan,coro-early' -S # RUN: at line 1
+ /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/bin/opt -passes=asan,coro-early -S
Intrinsic has incorrect return type!
ptr @llvm.coro.end
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/bin/opt: -: error: input module is broken!

--

********************


@llvm-ci
Copy link
Collaborator

llvm-ci commented Aug 25, 2025

LLVM Buildbot has detected a new failure on builder fuchsia-x86_64-linux running on fuchsia-debian-64-us-central1-a-1 while building clang,llvm,mlir at step 4 "annotate".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/11/builds/22533

Here is the relevant piece of the build log for the reference
Step 4 (annotate) failure: 'python ../llvm-zorg/zorg/buildbot/builders/annotated/fuchsia-linux.py ...' (failure)
...
  Passed           : 46702 (97.64%)
  Expectedly Failed:    26 (0.05%)
[1410/1412] Linking CXX executable unittests/tools/llvm-exegesis/LLVMExegesisTests
[1411/1412] Running the LLVM regression tests
llvm-lit: /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/utils/lit/lit/llvm/config.py:527: note: using ld.lld: /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-qw8xwfo0/bin/ld.lld
llvm-lit: /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/utils/lit/lit/llvm/config.py:527: note: using lld-link: /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-qw8xwfo0/bin/lld-link
llvm-lit: /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/utils/lit/lit/llvm/config.py:527: note: using ld64.lld: /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-qw8xwfo0/bin/ld64.lld
llvm-lit: /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/utils/lit/lit/llvm/config.py:527: note: using wasm-ld: /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-qw8xwfo0/bin/wasm-ld
-- Testing: 60746 tests, 60 workers --
Testing:  0.. 10.. 20.. 30.. 40.. 50
FAIL: LLVM :: Instrumentation/AddressSanitizer/coro-byval-param.ll (32357 of 60746)
******************** TEST 'LLVM :: Instrumentation/AddressSanitizer/coro-byval-param.ll' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
/var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-qw8xwfo0/bin/opt < /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/test/Instrumentation/AddressSanitizer/coro-byval-param.ll -passes='asan,coro-early' -S # RUN: at line 1
+ /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-qw8xwfo0/bin/opt -passes=asan,coro-early -S
Intrinsic has incorrect return type!
ptr @llvm.coro.end
/var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-qw8xwfo0/bin/opt: -: error: input module is broken!

--

********************
Testing:  0.. 10.. 20.. 30.. 40.. 50
FAIL: LLVM :: Instrumentation/HWAddressSanitizer/coro-byval-param.ll (32517 of 60746)
******************** TEST 'LLVM :: Instrumentation/HWAddressSanitizer/coro-byval-param.ll' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
/var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-qw8xwfo0/bin/opt < /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/test/Instrumentation/HWAddressSanitizer/coro-byval-param.ll -passes='hwasan,coro-early' -S # RUN: at line 1
+ /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-qw8xwfo0/bin/opt -passes=hwasan,coro-early -S
Intrinsic has incorrect return type!
ptr @llvm.coro.end
/var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-qw8xwfo0/bin/opt: -: error: input module is broken!

--

********************
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90.. 
********************
Failed Tests (2):
  LLVM :: Instrumentation/AddressSanitizer/coro-byval-param.ll
  LLVM :: Instrumentation/HWAddressSanitizer/coro-byval-param.ll


Testing Time: 80.11s
Step 7 (check) failure: check (failure)
...
  Passed           : 46702 (97.64%)
  Expectedly Failed:    26 (0.05%)
[1410/1412] Linking CXX executable unittests/tools/llvm-exegesis/LLVMExegesisTests
[1411/1412] Running the LLVM regression tests
llvm-lit: /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/utils/lit/lit/llvm/config.py:527: note: using ld.lld: /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-qw8xwfo0/bin/ld.lld
llvm-lit: /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/utils/lit/lit/llvm/config.py:527: note: using lld-link: /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-qw8xwfo0/bin/lld-link
llvm-lit: /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/utils/lit/lit/llvm/config.py:527: note: using ld64.lld: /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-qw8xwfo0/bin/ld64.lld
llvm-lit: /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/utils/lit/lit/llvm/config.py:527: note: using wasm-ld: /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-qw8xwfo0/bin/wasm-ld
-- Testing: 60746 tests, 60 workers --
Testing:  0.. 10.. 20.. 30.. 40.. 50
FAIL: LLVM :: Instrumentation/AddressSanitizer/coro-byval-param.ll (32357 of 60746)
******************** TEST 'LLVM :: Instrumentation/AddressSanitizer/coro-byval-param.ll' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
/var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-qw8xwfo0/bin/opt < /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/test/Instrumentation/AddressSanitizer/coro-byval-param.ll -passes='asan,coro-early' -S # RUN: at line 1
+ /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-qw8xwfo0/bin/opt -passes=asan,coro-early -S
Intrinsic has incorrect return type!
ptr @llvm.coro.end
/var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-qw8xwfo0/bin/opt: -: error: input module is broken!

--

********************
Testing:  0.. 10.. 20.. 30.. 40.. 50
FAIL: LLVM :: Instrumentation/HWAddressSanitizer/coro-byval-param.ll (32517 of 60746)
******************** TEST 'LLVM :: Instrumentation/HWAddressSanitizer/coro-byval-param.ll' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
/var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-qw8xwfo0/bin/opt < /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/test/Instrumentation/HWAddressSanitizer/coro-byval-param.ll -passes='hwasan,coro-early' -S # RUN: at line 1
+ /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-qw8xwfo0/bin/opt -passes=hwasan,coro-early -S
Intrinsic has incorrect return type!
ptr @llvm.coro.end
/var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-qw8xwfo0/bin/opt: -: error: input module is broken!

--

********************
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90.. 
********************
Failed Tests (2):
  LLVM :: Instrumentation/AddressSanitizer/coro-byval-param.ll
  LLVM :: Instrumentation/HWAddressSanitizer/coro-byval-param.ll


Testing Time: 80.11s

@llvm-ci
Copy link
Collaborator

llvm-ci commented Aug 25, 2025

LLVM Buildbot has detected a new failure on builder llvm-clang-x86_64-sie-win running on sie-win-worker while building clang,llvm,mlir at step 7 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/46/builds/22257

Here is the relevant piece of the build log for the reference
Step 7 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'LLVM :: Instrumentation/AddressSanitizer/coro-byval-param.ll' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 1
z:\b\llvm-clang-x86_64-sie-win\build\bin\opt.exe < Z:\b\llvm-clang-x86_64-sie-win\llvm-project\llvm\test\Instrumentation\AddressSanitizer\coro-byval-param.ll -passes='asan,coro-early' -S
# executed command: 'z:\b\llvm-clang-x86_64-sie-win\build\bin\opt.exe' -passes=asan,coro-early -S
# .---command stderr------------
# | Intrinsic has incorrect return type!
# | ptr @llvm.coro.end
# | z:\b\llvm-clang-x86_64-sie-win\build\bin\opt.exe: -: error: input module is broken!
# `-----------------------------
# error: command failed with exit status: 1

--

********************


@llvm-ci
Copy link
Collaborator

llvm-ci commented Aug 25, 2025

LLVM Buildbot has detected a new failure on builder llvm-clang-x86_64-gcc-ubuntu running on sie-linux-worker3 while building clang,llvm,mlir at step 6 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/174/builds/23374

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'LLVM :: Instrumentation/AddressSanitizer/coro-byval-param.ll' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
/home/buildbot/buildbot-root/llvm-clang-x86_64-gcc-ubuntu/build/bin/opt < /home/buildbot/buildbot-root/llvm-clang-x86_64-gcc-ubuntu/llvm-project/llvm/test/Instrumentation/AddressSanitizer/coro-byval-param.ll -passes='asan,coro-early' -S # RUN: at line 1
+ /home/buildbot/buildbot-root/llvm-clang-x86_64-gcc-ubuntu/build/bin/opt -passes=asan,coro-early -S
Intrinsic has incorrect return type!
ptr @llvm.coro.end
/home/buildbot/buildbot-root/llvm-clang-x86_64-gcc-ubuntu/build/bin/opt: -: error: input module is broken!

--

********************


@llvm-ci
Copy link
Collaborator

llvm-ci commented Aug 25, 2025

LLVM Buildbot has detected a new failure on builder ml-opt-devrel-x86-64 running on ml-opt-devrel-x86-64-b2 while building clang,llvm,mlir at step 6 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/175/builds/24036

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'LLVM :: Instrumentation/AddressSanitizer/coro-byval-param.ll' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
/b/ml-opt-devrel-x86-64-b1/build/bin/opt < /b/ml-opt-devrel-x86-64-b1/llvm-project/llvm/test/Instrumentation/AddressSanitizer/coro-byval-param.ll -passes='asan,coro-early' -S # RUN: at line 1
+ /b/ml-opt-devrel-x86-64-b1/build/bin/opt -passes=asan,coro-early -S
Intrinsic has incorrect return type!
ptr @llvm.coro.end
/b/ml-opt-devrel-x86-64-b1/build/bin/opt: -: error: input module is broken!

--

********************


@llvm-ci
Copy link
Collaborator

llvm-ci commented Aug 25, 2025

LLVM Buildbot has detected a new failure on builder ml-opt-dev-x86-64 running on ml-opt-dev-x86-64-b2 while building clang,llvm,mlir at step 6 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/137/builds/24187

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'LLVM :: Instrumentation/AddressSanitizer/coro-byval-param.ll' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
/b/ml-opt-dev-x86-64-b1/build/bin/opt < /b/ml-opt-dev-x86-64-b1/llvm-project/llvm/test/Instrumentation/AddressSanitizer/coro-byval-param.ll -passes='asan,coro-early' -S # RUN: at line 1
+ /b/ml-opt-dev-x86-64-b1/build/bin/opt -passes=asan,coro-early -S
Intrinsic has incorrect return type!
ptr @llvm.coro.end
/b/ml-opt-dev-x86-64-b1/build/bin/opt: -: error: input module is broken!

--

********************


@llvm-ci
Copy link
Collaborator

llvm-ci commented Aug 25, 2025

LLVM Buildbot has detected a new failure on builder clang-m68k-linux-cross running on suse-gary-m68k-cross while building clang,llvm,mlir at step 5 "ninja check 1".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/27/builds/15086

Here is the relevant piece of the build log for the reference
Step 5 (ninja check 1) failure: stage 1 checked (failure)
******************** TEST 'LLVM :: Instrumentation/HWAddressSanitizer/coro-byval-param.ll' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/bin/opt < /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/llvm/test/Instrumentation/HWAddressSanitizer/coro-byval-param.ll -passes='hwasan,coro-early' -S # RUN: at line 1
+ /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/bin/opt -passes=hwasan,coro-early -S
Intrinsic has incorrect return type!
ptr @llvm.coro.end
/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/bin/opt: -: error: input module is broken!

--

********************


@llvm-ci
Copy link
Collaborator

llvm-ci commented Aug 25, 2025

LLVM Buildbot has detected a new failure on builder ml-opt-rel-x86-64 running on ml-opt-rel-x86-64-b1 while building clang,llvm,mlir at step 6 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/185/builds/24027

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'LLVM :: Instrumentation/AddressSanitizer/coro-byval-param.ll' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
/b/ml-opt-rel-x86-64-b1/build/bin/opt < /b/ml-opt-rel-x86-64-b1/llvm-project/llvm/test/Instrumentation/AddressSanitizer/coro-byval-param.ll -passes='asan,coro-early' -S # RUN: at line 1
+ /b/ml-opt-rel-x86-64-b1/build/bin/opt -passes=asan,coro-early -S
Intrinsic has incorrect return type!
ptr @llvm.coro.end
/b/ml-opt-rel-x86-64-b1/build/bin/opt: -: error: input module is broken!

--

********************


@llvm-ci
Copy link
Collaborator

llvm-ci commented Aug 25, 2025

LLVM Buildbot has detected a new failure on builder flang-arm64-windows-msvc running on linaro-armv8-windows-msvc-01 while building clang,llvm,mlir at step 6 "test-build-unified-tree-check-mlir".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/207/builds/5933

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-mlir) failure: test (failure)
******************** TEST 'MLIR :: mlir-runner/test-expand-math-approx.mlir' FAILED ********************
Exit Code: 2

Command Output (stdout):
--
# RUN: at line 1
c:\users\tcwg\llvm-worker\flang-arm64-windows-msvc\build\bin\mlir-opt.exe C:\Users\tcwg\llvm-worker\flang-arm64-windows-msvc\llvm-project\mlir\test\mlir-runner\test-expand-math-approx.mlir -pass-pipeline="builtin.module(func.func(test-expand-math),convert-vector-to-scf,convert-scf-to-cf,convert-vector-to-llvm,convert-to-llvm,reconcile-unrealized-casts)"  | c:\users\tcwg\llvm-worker\flang-arm64-windows-msvc\build\bin\mlir-runner.exe                                                           -e main -entry-point-result=void -O0                                    -shared-libs=C:\Users\tcwg\llvm-worker\flang-arm64-windows-msvc\build\bin\mlir_c_runner_utils.dll       -shared-libs=C:\Users\tcwg\llvm-worker\flang-arm64-windows-msvc\build\bin\mlir_runner_utils.dll         -shared-libs=C:\Users\tcwg\llvm-worker\flang-arm64-windows-msvc\build\bin\mlir_float16_utils.dll    | c:\users\tcwg\llvm-worker\flang-arm64-windows-msvc\build\bin\filecheck.exe C:\Users\tcwg\llvm-worker\flang-arm64-windows-msvc\llvm-project\mlir\test\mlir-runner\test-expand-math-approx.mlir
# executed command: 'c:\users\tcwg\llvm-worker\flang-arm64-windows-msvc\build\bin\mlir-opt.exe' 'C:\Users\tcwg\llvm-worker\flang-arm64-windows-msvc\llvm-project\mlir\test\mlir-runner\test-expand-math-approx.mlir' '-pass-pipeline=builtin.module(func.func(test-expand-math),convert-vector-to-scf,convert-scf-to-cf,convert-vector-to-llvm,convert-to-llvm,reconcile-unrealized-casts)'
# executed command: 'c:\users\tcwg\llvm-worker\flang-arm64-windows-msvc\build\bin\mlir-runner.exe' -e main -entry-point-result=void -O0 '-shared-libs=C:\Users\tcwg\llvm-worker\flang-arm64-windows-msvc\build\bin\mlir_c_runner_utils.dll' '-shared-libs=C:\Users\tcwg\llvm-worker\flang-arm64-windows-msvc\build\bin\mlir_runner_utils.dll' '-shared-libs=C:\Users\tcwg\llvm-worker\flang-arm64-windows-msvc\build\bin\mlir_float16_utils.dll'
# .---command stderr------------
# | LLVM ERROR: Cannot select: intrinsic %llvm.aarch64.neon.ushl
# | PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
# | Stack dump:
# | 0.	Program arguments: c:\\users\\tcwg\\llvm-worker\\flang-arm64-windows-msvc\\build\\bin\\mlir-runner.exe -e main -entry-point-result=void -O0 -shared-libs=C:\\Users\\tcwg\\llvm-worker\\flang-arm64-windows-msvc\\build\\bin\\mlir_c_runner_utils.dll -shared-libs=C:\\Users\\tcwg\\llvm-worker\\flang-arm64-windows-msvc\\build\\bin\\mlir_runner_utils.dll -shared-libs=C:\\Users\\tcwg\\llvm-worker\\flang-arm64-windows-msvc\\build\\bin\\mlir_float16_utils.dll
# | 1.	Running pass 'Function Pass Manager' on module 'LLVMDialectModule'.
# | 2.	Running pass 'AArch64 Instruction Selection' on function '@"func_roundeven32$vector"'
# | Exception Code: 0xC000001D
# | #0 0x00007ff7306db05c mlir::detail::FallbackTypeIDResolver::registerImplicitTypeID(class llvm::StringRef) (c:\users\tcwg\llvm-worker\flang-arm64-windows-msvc\build\bin\mlir-runner.exe+0x2ab05c)
# | #1 0x00007fff6cdeae50 (C:\WINDOWS\System32\ucrtbase.dll+0x7ae50)
# | #2 0xf143ffff6cdeba5c
# `-----------------------------
# error: command failed with exit status: 0xc000001d
# executed command: 'c:\users\tcwg\llvm-worker\flang-arm64-windows-msvc\build\bin\filecheck.exe' 'C:\Users\tcwg\llvm-worker\flang-arm64-windows-msvc\llvm-project\mlir\test\mlir-runner\test-expand-math-approx.mlir'
# .---command stderr------------
# | FileCheck error: '<stdin>' is empty.
# | FileCheck command line:  c:\users\tcwg\llvm-worker\flang-arm64-windows-msvc\build\bin\filecheck.exe C:\Users\tcwg\llvm-worker\flang-arm64-windows-msvc\llvm-project\mlir\test\mlir-runner\test-expand-math-approx.mlir
# `-----------------------------
# error: command failed with exit status: 2

--

********************


@llvm-ci
Copy link
Collaborator

llvm-ci commented Aug 25, 2025

LLVM Buildbot has detected a new failure on builder clang-armv8-quick running on linaro-clang-armv8-quick while building clang,llvm,mlir at step 5 "ninja check 1".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/154/builds/20669

Here is the relevant piece of the build log for the reference
Step 5 (ninja check 1) failure: stage 1 checked (failure)
******************** TEST 'LLVM :: Instrumentation/AddressSanitizer/coro-byval-param.ll' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
/home/tcwg-buildbot/worker/clang-armv8-quick/stage1/bin/opt < /home/tcwg-buildbot/worker/clang-armv8-quick/llvm/llvm/test/Instrumentation/AddressSanitizer/coro-byval-param.ll -passes='asan,coro-early' -S # RUN: at line 1
+ /home/tcwg-buildbot/worker/clang-armv8-quick/stage1/bin/opt -passes=asan,coro-early -S
Intrinsic has incorrect return type!
ptr @llvm.coro.end
/home/tcwg-buildbot/worker/clang-armv8-quick/stage1/bin/opt: -: error: input module is broken!

--

********************


llvm-sync bot pushed a commit to arm/arm-toolchain that referenced this pull request Aug 25, 2025
…urn value of llvm.coro.end (#153404)"

This reverts commit 19a4f52.

See test failure in llvm/llvm-project#153404
@llvm-ci
Copy link
Collaborator

llvm-ci commented Aug 25, 2025

LLVM Buildbot has detected a new failure on builder clang-aarch64-quick running on linaro-clang-aarch64-quick while building clang,llvm,mlir at step 5 "ninja check 1".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/65/builds/21723

Here is the relevant piece of the build log for the reference
Step 5 (ninja check 1) failure: stage 1 checked (failure)
******************** TEST 'Clangd Unit Tests :: ./ClangdTests/243/332' FAILED ********************
Script(shard):
--
GTEST_OUTPUT=json:/home/tcwg-buildbot/worker/clang-aarch64-quick/stage1/tools/clang/tools/extra/clangd/unittests/./ClangdTests-Clangd Unit Tests-91586-243-332.json GTEST_SHUFFLE=0 GTEST_TOTAL_SHARDS=332 GTEST_SHARD_INDEX=243 /home/tcwg-buildbot/worker/clang-aarch64-quick/stage1/tools/clang/tools/extra/clangd/unittests/./ClangdTests
--

Note: This is test shard 244 of 332.
[==========] Running 4 tests from 4 test suites.
[----------] Global test environment set-up.
[----------] 1 test from CompletionStringTest
[ RUN      ] CompletionStringTest.Documentation
[       OK ] CompletionStringTest.Documentation (0 ms)
[----------] 1 test from CompletionStringTest (0 ms total)

[----------] 1 test from FuzzyMatch
[ RUN      ] FuzzyMatch.Matches
[       OK ] FuzzyMatch.Matches (26 ms)
[----------] 1 test from FuzzyMatch (27 ms total)

[----------] 1 test from CrossFileRenameTests
[ RUN      ] CrossFileRenameTests.ObjC
ASTWorker building file /clangd-test/foo.h version null with command 
[/clangd-test]
clang -xobjective-c /clangd-test/foo.h
Driver produced command: cc1 -cc1 -triple aarch64-unknown-linux-gnu -fsyntax-only -disable-free -clear-ast-before-backend -main-file-name foo.h -mrelocation-model pic -pic-level 2 -pic-is-pie -mframe-pointer=non-leaf -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -enable-tlsdesc -target-cpu generic -target-feature +v8a -target-feature +fp-armv8 -target-feature +neon -target-abi aapcs -debugger-tuning=gdb -fdebug-compilation-dir=/clangd-test -fcoverage-compilation-dir=/clangd-test -resource-dir lib/clang/22 -internal-isystem lib/clang/22/include -internal-isystem /usr/local/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -ferror-limit 19 -fno-signed-char -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -fobjc-runtime=gcc -fobjc-encode-cxx-class-template-spec -fobjc-exceptions -no-round-trip-args -target-feature -fmv -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -x objective-c /clangd-test/foo.h
Building first preamble for /clangd-test/foo.h version null
Built preamble of size 814120 for file /clangd-test/foo.h version null in 1.15 seconds
indexed preamble AST for /clangd-test/foo.h version null:
  symbol slab: 0 symbols, 120 bytes
  ref slab: 0 symbols, 0 refs, 128 bytes
  relations slab: 0 relations, 24 bytes
indexed file AST for /clangd-test/foo.h version null:
  symbol slab: 2 symbols, 4680 bytes
  ref slab: 2 symbols, 2 refs, 4272 bytes
  relations slab: 0 relations, 24 bytes
Build dynamic index for main-file symbols with estimated memory usage of 12040 bytes
ASTWorker building file /clangd-test/foo.m version null with command 
[/clangd-test]
clang -xobjective-c /clangd-test/foo.m
Driver produced command: cc1 -cc1 -triple aarch64-unknown-linux-gnu -fsyntax-only -disable-free -clear-ast-before-backend -main-file-name foo.m -mrelocation-model pic -pic-level 2 -pic-is-pie -mframe-pointer=non-leaf -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -enable-tlsdesc -target-cpu generic -target-feature +v8a -target-feature +fp-armv8 -target-feature +neon -target-abi aapcs -debugger-tuning=gdb -fdebug-compilation-dir=/clangd-test -fcoverage-compilation-dir=/clangd-test -resource-dir lib/clang/22 -internal-isystem lib/clang/22/include -internal-isystem /usr/local/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -ferror-limit 19 -fno-signed-char -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -fobjc-runtime=gcc -fobjc-encode-cxx-class-template-spec -fobjc-exceptions -no-round-trip-args -target-feature -fmv -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -x objective-c /clangd-test/foo.m
Building first preamble for /clangd-test/foo.m version null
Built preamble of size 814120 for file /clangd-test/foo.m version null in 0.38 seconds
indexed preamble AST for /clangd-test/foo.m version null:
  symbol slab: 0 symbols, 120 bytes
  ref slab: 0 symbols, 0 refs, 128 bytes
  relations slab: 0 relations, 24 bytes
indexed file AST for /clangd-test/foo.m version null:
  symbol slab: 2 symbols, 4680 bytes
  ref slab: 2 symbols, 3 refs, 4272 bytes
  relations slab: 0 relations, 24 bytes
...

@llvm-ci
Copy link
Collaborator

llvm-ci commented Aug 25, 2025

LLVM Buildbot has detected a new failure on builder clang-debian-cpp20 running on clang-debian-cpp20 while building clang,llvm,mlir at step 6 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/108/builds/16927

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'LLVM :: Instrumentation/AddressSanitizer/coro-byval-param.ll' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
/vol/worker/clang-debian-cpp20/clang-debian-cpp20/build/bin/opt < /vol/worker/clang-debian-cpp20/clang-debian-cpp20/llvm-project/llvm/test/Instrumentation/AddressSanitizer/coro-byval-param.ll -passes='asan,coro-early' -S # RUN: at line 1
+ /vol/worker/clang-debian-cpp20/clang-debian-cpp20/build/bin/opt -passes=asan,coro-early -S
Intrinsic has incorrect return type!
ptr @llvm.coro.end
/vol/worker/clang-debian-cpp20/clang-debian-cpp20/build/bin/opt: -: error: input module is broken!

--

********************


@llvm-ci
Copy link
Collaborator

llvm-ci commented Aug 25, 2025

LLVM Buildbot has detected a new failure on builder clang-ppc64le-linux-test-suite running on ppc64le-clang-test-suite while building clang,llvm,mlir at step 6 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/95/builds/17478

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'LLVM :: Instrumentation/HWAddressSanitizer/coro-byval-param.ll' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/bin/opt < /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/llvm-project/llvm/test/Instrumentation/HWAddressSanitizer/coro-byval-param.ll -passes='hwasan,coro-early' -S # RUN: at line 1
+ /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/bin/opt -passes=hwasan,coro-early -S
Intrinsic has incorrect return type!
ptr @llvm.coro.end
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/bin/opt: -: error: input module is broken!

--

********************


@llvm-ci
Copy link
Collaborator

llvm-ci commented Aug 25, 2025

LLVM Buildbot has detected a new failure on builder sanitizer-aarch64-linux-bootstrap-hwasan running on sanitizer-buildbot12 while building clang,llvm,mlir at step 2 "annotate".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/55/builds/16185

Here is the relevant piece of the build log for the reference
Step 2 (annotate) failure: 'python ../sanitizer_buildbot/sanitizers/zorg/buildbot/builders/sanitizers/buildbot_selector.py' (failure)
...
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:527: note: using lld-link: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/lld-link
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:527: note: using ld64.lld: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/ld64.lld
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:527: note: using wasm-ld: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/wasm-ld
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:527: note: using ld.lld: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/ld.lld
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:527: note: using lld-link: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/lld-link
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:527: note: using ld64.lld: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/ld64.lld
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:527: note: using wasm-ld: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/wasm-ld
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/main.py:74: note: The test suite configuration requested an individual test timeout of 0 seconds but a timeout of 900 seconds was requested on the command line. Forcing timeout to be 900 seconds.
-- Testing: 90015 tests, 72 workers --
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 
FAIL: LLVM :: Instrumentation/AddressSanitizer/coro-byval-param.ll (54707 of 90015)
******************** TEST 'LLVM :: Instrumentation/AddressSanitizer/coro-byval-param.ll' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
/home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/opt < /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/test/Instrumentation/AddressSanitizer/coro-byval-param.ll -passes='asan,coro-early' -S # RUN: at line 1
+ /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/opt -passes=asan,coro-early -S
Intrinsic has incorrect return type!
ptr @llvm.coro.end
/home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/opt: -: error: input module is broken!

--

********************
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 
FAIL: LLVM :: Instrumentation/HWAddressSanitizer/coro-byval-param.ll (54865 of 90015)
******************** TEST 'LLVM :: Instrumentation/HWAddressSanitizer/coro-byval-param.ll' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
/home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/opt < /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/test/Instrumentation/HWAddressSanitizer/coro-byval-param.ll -passes='hwasan,coro-early' -S # RUN: at line 1
+ /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/opt -passes=hwasan,coro-early -S
Intrinsic has incorrect return type!
ptr @llvm.coro.end
/home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/opt: -: error: input module is broken!

--

********************
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90.. 
Slowest Tests:
--------------------------------------------------------------------------
51.82s: Clang :: Driver/fsanitize.c
36.50s: LLVM :: CodeGen/AMDGPU/amdgcn.bitcast.1024bit.ll
35.98s: LLVM :: CodeGen/AMDGPU/sched-group-barrier-pipeline-solver.mir
33.18s: Clang :: Preprocessor/riscv-target-features.c
32.86s: Clang :: Driver/arm-cortex-cpus-2.c
Step 11 (stage2/hwasan check) failure: stage2/hwasan check (failure)
...
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:527: note: using lld-link: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/lld-link
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:527: note: using ld64.lld: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/ld64.lld
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:527: note: using wasm-ld: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/wasm-ld
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:527: note: using ld.lld: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/ld.lld
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:527: note: using lld-link: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/lld-link
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:527: note: using ld64.lld: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/ld64.lld
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:527: note: using wasm-ld: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/wasm-ld
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/main.py:74: note: The test suite configuration requested an individual test timeout of 0 seconds but a timeout of 900 seconds was requested on the command line. Forcing timeout to be 900 seconds.
-- Testing: 90015 tests, 72 workers --
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 
FAIL: LLVM :: Instrumentation/AddressSanitizer/coro-byval-param.ll (54707 of 90015)
******************** TEST 'LLVM :: Instrumentation/AddressSanitizer/coro-byval-param.ll' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
/home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/opt < /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/test/Instrumentation/AddressSanitizer/coro-byval-param.ll -passes='asan,coro-early' -S # RUN: at line 1
+ /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/opt -passes=asan,coro-early -S
Intrinsic has incorrect return type!
ptr @llvm.coro.end
/home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/opt: -: error: input module is broken!

--

********************
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 
FAIL: LLVM :: Instrumentation/HWAddressSanitizer/coro-byval-param.ll (54865 of 90015)
******************** TEST 'LLVM :: Instrumentation/HWAddressSanitizer/coro-byval-param.ll' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
/home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/opt < /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/test/Instrumentation/HWAddressSanitizer/coro-byval-param.ll -passes='hwasan,coro-early' -S # RUN: at line 1
+ /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/opt -passes=hwasan,coro-early -S
Intrinsic has incorrect return type!
ptr @llvm.coro.end
/home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/opt: -: error: input module is broken!

--

********************
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90.. 
Slowest Tests:
--------------------------------------------------------------------------
51.82s: Clang :: Driver/fsanitize.c
36.50s: LLVM :: CodeGen/AMDGPU/amdgcn.bitcast.1024bit.ll
35.98s: LLVM :: CodeGen/AMDGPU/sched-group-barrier-pipeline-solver.mir
33.18s: Clang :: Preprocessor/riscv-target-features.c
32.86s: Clang :: Driver/arm-cortex-cpus-2.c
Step 14 (stage3/hwasan check) failure: stage3/hwasan check (failure)
...
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:527: note: using lld-link: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build2_hwasan/bin/lld-link
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:527: note: using ld64.lld: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build2_hwasan/bin/ld64.lld
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:527: note: using wasm-ld: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build2_hwasan/bin/wasm-ld
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:527: note: using ld.lld: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build2_hwasan/bin/ld.lld
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:527: note: using lld-link: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build2_hwasan/bin/lld-link
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:527: note: using ld64.lld: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build2_hwasan/bin/ld64.lld
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:527: note: using wasm-ld: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build2_hwasan/bin/wasm-ld
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/main.py:74: note: The test suite configuration requested an individual test timeout of 0 seconds but a timeout of 900 seconds was requested on the command line. Forcing timeout to be 900 seconds.
-- Testing: 86724 tests, 72 workers --
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60
FAIL: LLVM :: Instrumentation/AddressSanitizer/coro-byval-param.ll (54710 of 86724)
******************** TEST 'LLVM :: Instrumentation/AddressSanitizer/coro-byval-param.ll' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
/home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build2_hwasan/bin/opt < /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/test/Instrumentation/AddressSanitizer/coro-byval-param.ll -passes='asan,coro-early' -S # RUN: at line 1
+ /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build2_hwasan/bin/opt -passes=asan,coro-early -S
Intrinsic has incorrect return type!
ptr @llvm.coro.end
/home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build2_hwasan/bin/opt: -: error: input module is broken!

--

********************
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60
FAIL: LLVM :: Instrumentation/HWAddressSanitizer/coro-byval-param.ll (54872 of 86724)
******************** TEST 'LLVM :: Instrumentation/HWAddressSanitizer/coro-byval-param.ll' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
/home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build2_hwasan/bin/opt < /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/test/Instrumentation/HWAddressSanitizer/coro-byval-param.ll -passes='hwasan,coro-early' -S # RUN: at line 1
+ /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build2_hwasan/bin/opt -passes=hwasan,coro-early -S
Intrinsic has incorrect return type!
ptr @llvm.coro.end
/home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build2_hwasan/bin/opt: -: error: input module is broken!

--

********************
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90.. 
Slowest Tests:
--------------------------------------------------------------------------
23.38s: LLVM :: tools/llvm-reduce/parallel-workitem-kill.ll
13.65s: Clang :: Driver/fsanitize.c
11.55s: LLVM :: CodeGen/AMDGPU/amdgcn.bitcast.1024bit.ll
10.01s: LLVM-Unit :: Support/./SupportTests/ProgramEnvTest/TestExecuteNoWaitDetached
8.53s: Clang :: Preprocessor/riscv-target-features.c

@llvm-ci
Copy link
Collaborator

llvm-ci commented Aug 25, 2025

LLVM Buildbot has detected a new failure on builder ppc64le-lld-multistage-test running on ppc64le-lld-multistage-test while building clang,llvm,mlir at step 7 "test-build-stage1-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/168/builds/15557

Here is the relevant piece of the build log for the reference
Step 7 (test-build-stage1-unified-tree-check-all) failure: test (failure)
******************** TEST 'LLVM :: Instrumentation/HWAddressSanitizer/coro-byval-param.ll' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
/home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/build/stage1/bin/opt < /home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/llvm/test/Instrumentation/HWAddressSanitizer/coro-byval-param.ll -passes='hwasan,coro-early' -S # RUN: at line 1
+ /home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/build/stage1/bin/opt -passes=hwasan,coro-early -S
Intrinsic has incorrect return type!
ptr @llvm.coro.end
/home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/build/stage1/bin/opt: -: error: input module is broken!

--

********************

Step 13 (test-build-stage2-unified-tree-check-all) failure: test (failure)
******************** TEST 'LLVM :: Instrumentation/AddressSanitizer/coro-byval-param.ll' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
/home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/build/stage2/bin/opt < /home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/llvm/test/Instrumentation/AddressSanitizer/coro-byval-param.ll -passes='asan,coro-early' -S # RUN: at line 1
+ /home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/build/stage2/bin/opt -passes=asan,coro-early -S
Intrinsic has incorrect return type!
ptr @llvm.coro.end
/home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/build/stage2/bin/opt: -: error: input module is broken!

--

********************


@llvm-ci
Copy link
Collaborator

llvm-ci commented Aug 25, 2025

LLVM Buildbot has detected a new failure on builder sanitizer-aarch64-linux-bootstrap-ubsan running on sanitizer-buildbot9 while building clang,llvm,mlir at step 2 "annotate".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/85/builds/12642

Here is the relevant piece of the build log for the reference
Step 2 (annotate) failure: 'python ../sanitizer_buildbot/sanitizers/zorg/buildbot/builders/sanitizers/buildbot_selector.py' (failure)
...
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-ubsan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:527: note: using lld-link: /home/b/sanitizer-aarch64-linux-bootstrap-ubsan/build/llvm_build_ubsan/bin/lld-link
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-ubsan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:527: note: using ld64.lld: /home/b/sanitizer-aarch64-linux-bootstrap-ubsan/build/llvm_build_ubsan/bin/ld64.lld
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-ubsan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:527: note: using wasm-ld: /home/b/sanitizer-aarch64-linux-bootstrap-ubsan/build/llvm_build_ubsan/bin/wasm-ld
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-ubsan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:527: note: using ld.lld: /home/b/sanitizer-aarch64-linux-bootstrap-ubsan/build/llvm_build_ubsan/bin/ld.lld
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-ubsan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:527: note: using lld-link: /home/b/sanitizer-aarch64-linux-bootstrap-ubsan/build/llvm_build_ubsan/bin/lld-link
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-ubsan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:527: note: using ld64.lld: /home/b/sanitizer-aarch64-linux-bootstrap-ubsan/build/llvm_build_ubsan/bin/ld64.lld
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-ubsan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:527: note: using wasm-ld: /home/b/sanitizer-aarch64-linux-bootstrap-ubsan/build/llvm_build_ubsan/bin/wasm-ld
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-ubsan/build/llvm-project/llvm/utils/lit/lit/main.py:74: note: The test suite configuration requested an individual test timeout of 0 seconds but a timeout of 900 seconds was requested on the command line. Forcing timeout to be 900 seconds.
-- Testing: 90016 tests, 72 workers --
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 
FAIL: LLVM :: Instrumentation/AddressSanitizer/coro-byval-param.ll (54716 of 90016)
******************** TEST 'LLVM :: Instrumentation/AddressSanitizer/coro-byval-param.ll' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
/home/b/sanitizer-aarch64-linux-bootstrap-ubsan/build/llvm_build_ubsan/bin/opt < /home/b/sanitizer-aarch64-linux-bootstrap-ubsan/build/llvm-project/llvm/test/Instrumentation/AddressSanitizer/coro-byval-param.ll -passes='asan,coro-early' -S # RUN: at line 1
+ /home/b/sanitizer-aarch64-linux-bootstrap-ubsan/build/llvm_build_ubsan/bin/opt -passes=asan,coro-early -S
Intrinsic has incorrect return type!
ptr @llvm.coro.end
/home/b/sanitizer-aarch64-linux-bootstrap-ubsan/build/llvm_build_ubsan/bin/opt: -: error: input module is broken!

--

********************
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 
FAIL: LLVM :: Instrumentation/HWAddressSanitizer/coro-byval-param.ll (54878 of 90016)
******************** TEST 'LLVM :: Instrumentation/HWAddressSanitizer/coro-byval-param.ll' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
/home/b/sanitizer-aarch64-linux-bootstrap-ubsan/build/llvm_build_ubsan/bin/opt < /home/b/sanitizer-aarch64-linux-bootstrap-ubsan/build/llvm-project/llvm/test/Instrumentation/HWAddressSanitizer/coro-byval-param.ll -passes='hwasan,coro-early' -S # RUN: at line 1
+ /home/b/sanitizer-aarch64-linux-bootstrap-ubsan/build/llvm_build_ubsan/bin/opt -passes=hwasan,coro-early -S
Intrinsic has incorrect return type!
ptr @llvm.coro.end
/home/b/sanitizer-aarch64-linux-bootstrap-ubsan/build/llvm_build_ubsan/bin/opt: -: error: input module is broken!

--

********************
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90.. 
Slowest Tests:
--------------------------------------------------------------------------
141.05s: Clang :: Driver/fsanitize.c
90.94s: Clang :: Driver/arm-cortex-cpus-2.c
89.29s: Clang :: Driver/arm-cortex-cpus-1.c
76.49s: Clang :: OpenMP/target_defaultmap_codegen_01.cpp
68.45s: Clang :: OpenMP/target_update_codegen.cpp
Step 11 (stage2/ubsan check) failure: stage2/ubsan check (failure)
...
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-ubsan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:527: note: using lld-link: /home/b/sanitizer-aarch64-linux-bootstrap-ubsan/build/llvm_build_ubsan/bin/lld-link
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-ubsan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:527: note: using ld64.lld: /home/b/sanitizer-aarch64-linux-bootstrap-ubsan/build/llvm_build_ubsan/bin/ld64.lld
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-ubsan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:527: note: using wasm-ld: /home/b/sanitizer-aarch64-linux-bootstrap-ubsan/build/llvm_build_ubsan/bin/wasm-ld
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-ubsan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:527: note: using ld.lld: /home/b/sanitizer-aarch64-linux-bootstrap-ubsan/build/llvm_build_ubsan/bin/ld.lld
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-ubsan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:527: note: using lld-link: /home/b/sanitizer-aarch64-linux-bootstrap-ubsan/build/llvm_build_ubsan/bin/lld-link
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-ubsan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:527: note: using ld64.lld: /home/b/sanitizer-aarch64-linux-bootstrap-ubsan/build/llvm_build_ubsan/bin/ld64.lld
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-ubsan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:527: note: using wasm-ld: /home/b/sanitizer-aarch64-linux-bootstrap-ubsan/build/llvm_build_ubsan/bin/wasm-ld
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-ubsan/build/llvm-project/llvm/utils/lit/lit/main.py:74: note: The test suite configuration requested an individual test timeout of 0 seconds but a timeout of 900 seconds was requested on the command line. Forcing timeout to be 900 seconds.
-- Testing: 90016 tests, 72 workers --
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 
FAIL: LLVM :: Instrumentation/AddressSanitizer/coro-byval-param.ll (54716 of 90016)
******************** TEST 'LLVM :: Instrumentation/AddressSanitizer/coro-byval-param.ll' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
/home/b/sanitizer-aarch64-linux-bootstrap-ubsan/build/llvm_build_ubsan/bin/opt < /home/b/sanitizer-aarch64-linux-bootstrap-ubsan/build/llvm-project/llvm/test/Instrumentation/AddressSanitizer/coro-byval-param.ll -passes='asan,coro-early' -S # RUN: at line 1
+ /home/b/sanitizer-aarch64-linux-bootstrap-ubsan/build/llvm_build_ubsan/bin/opt -passes=asan,coro-early -S
Intrinsic has incorrect return type!
ptr @llvm.coro.end
/home/b/sanitizer-aarch64-linux-bootstrap-ubsan/build/llvm_build_ubsan/bin/opt: -: error: input module is broken!

--

********************
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 
FAIL: LLVM :: Instrumentation/HWAddressSanitizer/coro-byval-param.ll (54878 of 90016)
******************** TEST 'LLVM :: Instrumentation/HWAddressSanitizer/coro-byval-param.ll' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
/home/b/sanitizer-aarch64-linux-bootstrap-ubsan/build/llvm_build_ubsan/bin/opt < /home/b/sanitizer-aarch64-linux-bootstrap-ubsan/build/llvm-project/llvm/test/Instrumentation/HWAddressSanitizer/coro-byval-param.ll -passes='hwasan,coro-early' -S # RUN: at line 1
+ /home/b/sanitizer-aarch64-linux-bootstrap-ubsan/build/llvm_build_ubsan/bin/opt -passes=hwasan,coro-early -S
Intrinsic has incorrect return type!
ptr @llvm.coro.end
/home/b/sanitizer-aarch64-linux-bootstrap-ubsan/build/llvm_build_ubsan/bin/opt: -: error: input module is broken!

--

********************
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90.. 
Slowest Tests:
--------------------------------------------------------------------------
141.05s: Clang :: Driver/fsanitize.c
90.94s: Clang :: Driver/arm-cortex-cpus-2.c
89.29s: Clang :: Driver/arm-cortex-cpus-1.c
76.49s: Clang :: OpenMP/target_defaultmap_codegen_01.cpp
68.45s: Clang :: OpenMP/target_update_codegen.cpp
Step 14 (stage3/ubsan check) failure: stage3/ubsan check (failure)
...
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-ubsan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:527: note: using lld-link: /home/b/sanitizer-aarch64-linux-bootstrap-ubsan/build/llvm_build2_ubsan/bin/lld-link
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-ubsan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:527: note: using ld64.lld: /home/b/sanitizer-aarch64-linux-bootstrap-ubsan/build/llvm_build2_ubsan/bin/ld64.lld
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-ubsan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:527: note: using wasm-ld: /home/b/sanitizer-aarch64-linux-bootstrap-ubsan/build/llvm_build2_ubsan/bin/wasm-ld
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-ubsan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:527: note: using ld.lld: /home/b/sanitizer-aarch64-linux-bootstrap-ubsan/build/llvm_build2_ubsan/bin/ld.lld
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-ubsan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:527: note: using lld-link: /home/b/sanitizer-aarch64-linux-bootstrap-ubsan/build/llvm_build2_ubsan/bin/lld-link
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-ubsan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:527: note: using ld64.lld: /home/b/sanitizer-aarch64-linux-bootstrap-ubsan/build/llvm_build2_ubsan/bin/ld64.lld
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-ubsan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:527: note: using wasm-ld: /home/b/sanitizer-aarch64-linux-bootstrap-ubsan/build/llvm_build2_ubsan/bin/wasm-ld
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-ubsan/build/llvm-project/llvm/utils/lit/lit/main.py:74: note: The test suite configuration requested an individual test timeout of 0 seconds but a timeout of 900 seconds was requested on the command line. Forcing timeout to be 900 seconds.
-- Testing: 86724 tests, 72 workers --
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60
FAIL: LLVM :: Instrumentation/AddressSanitizer/coro-byval-param.ll (54715 of 86724)
******************** TEST 'LLVM :: Instrumentation/AddressSanitizer/coro-byval-param.ll' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
/home/b/sanitizer-aarch64-linux-bootstrap-ubsan/build/llvm_build2_ubsan/bin/opt < /home/b/sanitizer-aarch64-linux-bootstrap-ubsan/build/llvm-project/llvm/test/Instrumentation/AddressSanitizer/coro-byval-param.ll -passes='asan,coro-early' -S # RUN: at line 1
+ /home/b/sanitizer-aarch64-linux-bootstrap-ubsan/build/llvm_build2_ubsan/bin/opt -passes=asan,coro-early -S
Intrinsic has incorrect return type!
ptr @llvm.coro.end
/home/b/sanitizer-aarch64-linux-bootstrap-ubsan/build/llvm_build2_ubsan/bin/opt: -: error: input module is broken!

--

********************
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60
FAIL: LLVM :: Instrumentation/HWAddressSanitizer/coro-byval-param.ll (54893 of 86724)
******************** TEST 'LLVM :: Instrumentation/HWAddressSanitizer/coro-byval-param.ll' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
/home/b/sanitizer-aarch64-linux-bootstrap-ubsan/build/llvm_build2_ubsan/bin/opt < /home/b/sanitizer-aarch64-linux-bootstrap-ubsan/build/llvm-project/llvm/test/Instrumentation/HWAddressSanitizer/coro-byval-param.ll -passes='hwasan,coro-early' -S # RUN: at line 1
+ /home/b/sanitizer-aarch64-linux-bootstrap-ubsan/build/llvm_build2_ubsan/bin/opt -passes=hwasan,coro-early -S
Intrinsic has incorrect return type!
ptr @llvm.coro.end
/home/b/sanitizer-aarch64-linux-bootstrap-ubsan/build/llvm_build2_ubsan/bin/opt: -: error: input module is broken!

--

********************
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90.. 
Slowest Tests:
--------------------------------------------------------------------------
23.75s: LLVM :: tools/llvm-reduce/parallel-workitem-kill.ll
23.04s: Clang :: Driver/fsanitize.c
21.34s: LLVM :: CodeGen/AMDGPU/amdgcn.bitcast.1024bit.ll
15.49s: Clang :: CodeGen/AArch64/sve-intrinsics/acle_sve_reinterpret.c
14.73s: Clang :: OpenMP/target_update_codegen.cpp

@NewSigma NewSigma deleted the coro_where branch August 25, 2025 10:57
@llvm-ci
Copy link
Collaborator

llvm-ci commented Aug 25, 2025

LLVM Buildbot has detected a new failure on builder llvm-nvptx64-nvidia-ubuntu running on as-builder-7 while building clang,llvm,mlir at step 6 "test-build-unified-tree-check-llvm".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/160/builds/23572

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-llvm) failure: test (failure)
******************** TEST 'LLVM :: Instrumentation/AddressSanitizer/coro-byval-param.ll' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
/home/buildbot/worker/as-builder-7/llvm-nvptx64-nvidia-ubuntu/build/bin/opt < /home/buildbot/worker/as-builder-7/llvm-nvptx64-nvidia-ubuntu/llvm-project/llvm/test/Instrumentation/AddressSanitizer/coro-byval-param.ll -passes='asan,coro-early' -S # RUN: at line 1
+ /home/buildbot/worker/as-builder-7/llvm-nvptx64-nvidia-ubuntu/build/bin/opt -passes=asan,coro-early -S
Intrinsic has incorrect return type!
ptr @llvm.coro.end
/home/buildbot/worker/as-builder-7/llvm-nvptx64-nvidia-ubuntu/build/bin/opt: -: error: input module is broken!

--

********************


@llvm-ci
Copy link
Collaborator

llvm-ci commented Aug 25, 2025

LLVM Buildbot has detected a new failure on builder llvm-nvptx-nvidia-ubuntu running on as-builder-7 while building clang,llvm,mlir at step 6 "test-build-unified-tree-check-llvm".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/180/builds/23716

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-llvm) failure: test (failure)
******************** TEST 'LLVM :: Instrumentation/AddressSanitizer/coro-byval-param.ll' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
/home/buildbot/worker/as-builder-7/llvm-nvptx-nvidia-ubuntu/build/bin/opt < /home/buildbot/worker/as-builder-7/llvm-nvptx-nvidia-ubuntu/llvm-project/llvm/test/Instrumentation/AddressSanitizer/coro-byval-param.ll -passes='asan,coro-early' -S # RUN: at line 1
+ /home/buildbot/worker/as-builder-7/llvm-nvptx-nvidia-ubuntu/build/bin/opt -passes=asan,coro-early -S
Intrinsic has incorrect return type!
ptr @llvm.coro.end
/home/buildbot/worker/as-builder-7/llvm-nvptx-nvidia-ubuntu/build/bin/opt: -: error: input module is broken!

--

********************


NewSigma added a commit that referenced this pull request Sep 17, 2025
…of llvm.coro.end #153404" (#155339)

As mentioned in #151067, current design of llvm.coro.end mixes two
functionalities: querying where we are and lowering to some code. This
patch separate these functionalities into independent intrinsics by
introducing a new intrinsic llvm.coro.is_in_ramp.
NewSigma added a commit that referenced this pull request Sep 17, 2025
…n value of llvm.coro.end #153404"" (#159236)

Reverts #155339 because of CI fail
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clang:codegen IR generation bugs: mangling, exceptions, etc. clang Clang issues not falling into any other category coroutines C++20 coroutines llvm:analysis Includes value tracking, cost tables and constant folding llvm:ir llvm:transforms mlir:llvm mlir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants