[Mlir-commits] [mlir] 36d384b - [mlir][Transforms][NFC] Dialect conversion: Simplify `EraseBlockRewrite` constructor (#99805)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Mon Jul 22 00:09:07 PDT 2024


Author: Matthias Springer
Date: 2024-07-22T09:09:02+02:00
New Revision: 36d384b4ddb54d40866614df5128be60f36d92a2

URL: https://github.com/llvm/llvm-project/commit/36d384b4ddb54d40866614df5128be60f36d92a2
DIFF: https://github.com/llvm/llvm-project/commit/36d384b4ddb54d40866614df5128be60f36d92a2.diff

LOG: [mlir][Transforms][NFC] Dialect conversion: Simplify `EraseBlockRewrite` constructor (#99805)

Added: 
    

Modified: 
    mlir/lib/Transforms/Utils/DialectConversion.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Transforms/Utils/DialectConversion.cpp b/mlir/lib/Transforms/Utils/DialectConversion.cpp
index 0b552a7e1ca3b..a045868b66031 100644
--- a/mlir/lib/Transforms/Utils/DialectConversion.cpp
+++ b/mlir/lib/Transforms/Utils/DialectConversion.cpp
@@ -293,10 +293,9 @@ class CreateBlockRewrite : public BlockRewrite {
 /// original location.
 class EraseBlockRewrite : public BlockRewrite {
 public:
-  EraseBlockRewrite(ConversionPatternRewriterImpl &rewriterImpl, Block *block,
-                    Region *region, Block *insertBeforeBlock)
-      : BlockRewrite(Kind::EraseBlock, rewriterImpl, block), region(region),
-        insertBeforeBlock(insertBeforeBlock) {}
+  EraseBlockRewrite(ConversionPatternRewriterImpl &rewriterImpl, Block *block)
+      : BlockRewrite(Kind::EraseBlock, rewriterImpl, block),
+        region(block->getParent()), insertBeforeBlock(block->getNextNode()) {}
 
   static bool classof(const IRRewrite *rewrite) {
     return rewrite->getKind() == Kind::EraseBlock;
@@ -1440,9 +1439,7 @@ void ConversionPatternRewriterImpl::notifyOpReplaced(Operation *op,
 }
 
 void ConversionPatternRewriterImpl::notifyBlockIsBeingErased(Block *block) {
-  Region *region = block->getParent();
-  Block *origNextBlock = block->getNextNode();
-  appendRewrite<EraseBlockRewrite>(block, region, origNextBlock);
+  appendRewrite<EraseBlockRewrite>(block);
 }
 
 void ConversionPatternRewriterImpl::notifyBlockInserted(


        


More information about the Mlir-commits mailing list