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

via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 7 04:17:42 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();
----------------
NewSigma wrote:

Since DSE happens after CoroEarly, llvm.coro.promise should have been lowered.

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


More information about the llvm-commits mailing list