[Mlir-commits] [mlir] [mlir][Transforms] `GreedyPatternRewriteDriver`: Hash ops separately (PR #78312)
Jacques Pienaar
llvmlistbot at llvm.org
Fri Jan 19 17:48:17 PST 2024
================
@@ -125,14 +128,18 @@ struct ExpensiveChecks : public RewriterBase::ForwardingListener {
protected:
/// Invalidate the finger print of the given op, i.e., remove it from the map.
- void invalidateFingerPrint(Operation *op) {
- // Invalidate all finger prints until the top level.
- while (op && op != topLevel) {
- fingerprints.erase(op);
- op = op->getParentOp();
- }
- }
+ void invalidateFingerPrint(Operation *op) { fingerprints.erase(op); }
+ void notifyBlockRemoved(Block *block) override {
+ RewriterBase::ForwardingListener::notifyBlockRemoved(block);
+
+ // The block structure (number of blocks, types of block arguments, etc.)
+ // is part of the fingerprint of the parent op.
+ // TODO: The parent op fingerprint should also be invalidated when modifying
+ // the block arguments of a block, but we do not have a
+ // `notifyBlockModified` callback yet.
+ invalidateFingerPrint(block->getParentOp());
----------------
jpienaar wrote:
I would have expected the listening and invalidation would be guarded to if there is a listener/expensive checks is enabled only.
https://github.com/llvm/llvm-project/pull/78312
More information about the Mlir-commits
mailing list