[Mlir-commits] [mlir] 569ca0f - [mlir][async] Erase op later to preserve insertion point (#146516)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Tue Jul 1 08:25:24 PDT 2025


Author: Matthias Springer
Date: 2025-07-01T17:25:21+02:00
New Revision: 569ca0f69876ffbf7f27494b4bf212e8d236f7e9

URL: https://github.com/llvm/llvm-project/commit/569ca0f69876ffbf7f27494b4bf212e8d236f7e9
DIFF: https://github.com/llvm/llvm-project/commit/569ca0f69876ffbf7f27494b4bf212e8d236f7e9.diff

LOG: [mlir][async] Erase op later to preserve insertion point (#146516)

Delay the erasure of an op, so that the insertion point of the rewriter
remains valid.

This commit is in preparation of the One-Shot Dialect Conversion
refactoring. (The current implementation works with the current dialect
conversion driver because op erasure is delayed.)

Added: 
    

Modified: 
    mlir/lib/Dialect/Async/Transforms/AsyncToAsyncRuntime.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Dialect/Async/Transforms/AsyncToAsyncRuntime.cpp b/mlir/lib/Dialect/Async/Transforms/AsyncToAsyncRuntime.cpp
index c289faaf9983c..8601bb5aaada9 100644
--- a/mlir/lib/Dialect/Async/Transforms/AsyncToAsyncRuntime.cpp
+++ b/mlir/lib/Dialect/Async/Transforms/AsyncToAsyncRuntime.cpp
@@ -723,8 +723,8 @@ class YieldOpLowering : public OpConversionPattern<async::YieldOp> {
       // Switch the coroutine completion token to available state.
       rewriter.create<RuntimeSetAvailableOp>(loc, *coro.asyncToken);
 
-    rewriter.eraseOp(op);
     rewriter.create<cf::BranchOp>(loc, coro.cleanup);
+    rewriter.eraseOp(op);
 
     return success();
   }


        


More information about the Mlir-commits mailing list