[llvm] [DSE] Mark promise of pre-split coroutine visible to caller (PR #133918)

Chuanqi Xu via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 6 20:04:53 PDT 2025


================
@@ -990,6 +993,18 @@ struct DSEState {
     for (BasicBlock *BB : post_order(&F)) {
       PostOrderNumbers[BB] = PO++;
       for (Instruction &I : *BB) {
+        auto *II = dyn_cast<IntrinsicInst>(&I);
+        if (F.isPresplitCoroutine() && II != nullptr) {
+          const auto ID = II->getIntrinsicID();
+          if (ID == Intrinsic::coro_begin ||
+              ID == Intrinsic::coro_begin_custom_abi) {
+            auto *AnyCoroId = cast<CoroBeginInst>(II)->getId();
+            auto *CoroId = dyn_cast_if_present<CoroIdInst>(AnyCoroId);
+            if (CoroId)
+              PresplitCoroPromise = CoroId->getPromise();
----------------
ChuanqiXu9 wrote:

Maybe we can find `llvm.coro.promise` directly.

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


More information about the llvm-commits mailing list