[Mlir-commits] [mlir] [mlir][Transforms][NFC] Dialect conversion: Simplify `EraseBlockRewrite` constructor (PR #99805)
Matthias Springer
llvmlistbot at llvm.org
Sun Jul 21 01:58:25 PDT 2024
https://github.com/matthias-springer created https://github.com/llvm/llvm-project/pull/99805
None
>From ef6e32f80845b1b9c3a51246a3545e6f975acda0 Mon Sep 17 00:00:00 2001
From: Matthias Springer <mspringer at nvidia.com>
Date: Sun, 21 Jul 2024 10:56:43 +0200
Subject: [PATCH] [mlir][Transforms][NFC] Dialect conversion: Simplify
`EraseBlockRewrite` constructor
---
mlir/lib/Transforms/Utils/DialectConversion.cpp | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
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