[Mlir-commits] [mlir] [MLIR] [Transforms] Let lowerToLoopsUsingSCFForOp delete target op, fixes #83252 (PR #83256)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Wed Feb 28 10:17:29 PST 2024


https://github.com/lhunloh updated https://github.com/llvm/llvm-project/pull/83256

>From 2f1ef500a3295a3763174b6f1b4718a5a16a38f6 Mon Sep 17 00:00:00 2001
From: Lars <larshunloh at uni-muenster.de>
Date: Wed, 28 Feb 2024 13:15:14 +0100
Subject: [PATCH] Let lowerToLoopsUsingSCFForOp delete target op.

The function mlir::scf::lowerToLoopsUsingSCFForOp was not deleting its
(structured) target op, resulting in IR with the expected loop nest in
front of the still remaining (structured) op, e.g. a linalg.matmul.
---
 mlir/lib/Dialect/SCF/Transforms/TileUsingInterface.cpp | 1 +
 1 file changed, 1 insertion(+)

diff --git a/mlir/lib/Dialect/SCF/Transforms/TileUsingInterface.cpp b/mlir/lib/Dialect/SCF/Transforms/TileUsingInterface.cpp
index 1a84a59ddb69df..e1e9be858b251e 100644
--- a/mlir/lib/Dialect/SCF/Transforms/TileUsingInterface.cpp
+++ b/mlir/lib/Dialect/SCF/Transforms/TileUsingInterface.cpp
@@ -1133,5 +1133,6 @@ mlir::scf::lowerToLoopsUsingSCFForOp(RewriterBase &rewriter,
   if (failed(op.generateScalarImplementation(rewriter, op.getLoc(), ivs))) {
     return failure();
   }
+  rewriter.eraseOp(op);
   return loops;
 }



More information about the Mlir-commits mailing list