[Mlir-commits] [mlir] [mlir][NFC] Remove redundant insertion point changes (PR #161837)

Markus Böck llvmlistbot at llvm.org
Fri Oct 3 05:41:12 PDT 2025


https://github.com/zero9178 created https://github.com/llvm/llvm-project/pull/161837

These insertion points were added in https://github.com/llvm/llvm-project/pull/146551 and https://github.com/llvm/llvm-project/pull/146908 to support the one-shot dialect conversion driver which performs changes to the IR immediately and would otherwise invalidate previous insertion points.

Since then, the insertion point has been made resilient against op erasure (https://github.com/llvm/llvm-project/pull/146955) making the changes now redundant.

>From 01be0d1f2ff82d09af8636c8f1eb634d151b499d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Markus=20B=C3=B6ck?= <markus.boeck02 at gmail.com>
Date: Fri, 3 Oct 2025 14:40:39 +0200
Subject: [PATCH] [mlir][NFC] Remove redundant insertion point changes

These insertion points were added in https://github.com/llvm/llvm-project/pull/146551 and https://github.com/llvm/llvm-project/pull/146908 to support the one-shot dialect conversion driver which performs changes to the IR immediately and would otherwise invalidate previous insertion points.

Since then, the insertion point has been made resilient against op erasure (https://github.com/llvm/llvm-project/pull/146955) making the changes now redundant.
---
 .../Conversion/SPIRVToLLVM/ConvertLaunchFuncToLLVMCalls.cpp   | 4 +---
 mlir/lib/Conversion/TosaToLinalg/TosaToLinalgNamed.cpp        | 1 -
 2 files changed, 1 insertion(+), 4 deletions(-)

diff --git a/mlir/lib/Conversion/SPIRVToLLVM/ConvertLaunchFuncToLLVMCalls.cpp b/mlir/lib/Conversion/SPIRVToLLVM/ConvertLaunchFuncToLLVMCalls.cpp
index 035f197b1eac2..882d06f8e895c 100644
--- a/mlir/lib/Conversion/SPIRVToLLVM/ConvertLaunchFuncToLLVMCalls.cpp
+++ b/mlir/lib/Conversion/SPIRVToLLVM/ConvertLaunchFuncToLLVMCalls.cpp
@@ -267,9 +267,7 @@ class GPULaunchLowering : public ConvertOpToLLVMPattern<gpu::LaunchFuncOp> {
       copyInfo.push_back(info);
     }
     // Create a call to the kernel and copy the data back.
-    Operation *callOp = rewriter.replaceOpWithNewOp<LLVM::CallOp>(
-        op, kernelFunc, ArrayRef<Value>());
-    rewriter.setInsertionPointAfter(callOp);
+    rewriter.replaceOpWithNewOp<LLVM::CallOp>(op, kernelFunc, ArrayRef<Value>());
     for (CopyInfo info : copyInfo)
       copy(loc, info.src, info.dst, info.size, rewriter);
     return success();
diff --git a/mlir/lib/Conversion/TosaToLinalg/TosaToLinalgNamed.cpp b/mlir/lib/Conversion/TosaToLinalg/TosaToLinalgNamed.cpp
index 6f288495516f7..0cb0badacf69d 100644
--- a/mlir/lib/Conversion/TosaToLinalg/TosaToLinalgNamed.cpp
+++ b/mlir/lib/Conversion/TosaToLinalg/TosaToLinalgNamed.cpp
@@ -802,7 +802,6 @@ class MaxPool2dConverter : public OpConversionPattern<tosa::MaxPool2dOp> {
         ValueRange{paddedInput, fakeWindowDims}, filledEmptyTensor, strideAttr,
         dilationAttr);
 
-    rewriter.setInsertionPointAfter(op);
     NanPropagationMode nanMode = op.getNanMode();
     rewriter.replaceOp(op, resultOp);
 



More information about the Mlir-commits mailing list