[all-commits] [llvm/llvm-project] 9bdfa8: [mlir][IR] Use Listener for IR callbacks in Operat...
Matthias Springer via All-commits
all-commits at lists.llvm.org
Thu Feb 23 00:03:00 PST 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 9bdfa8df0db21845b8e1d8fc0fc8b70dfe25f45d
https://github.com/llvm/llvm-project/commit/9bdfa8df0db21845b8e1d8fc0fc8b70dfe25f45d
Author: Matthias Springer <me at m-sp.org>
Date: 2023-02-23 (Thu, 23 Feb 2023)
Changed paths:
M mlir/include/mlir/Transforms/FoldUtils.h
M mlir/lib/Transforms/Utils/FoldUtils.cpp
M mlir/lib/Transforms/Utils/GreedyPatternRewriteDriver.cpp
M mlir/test/lib/Dialect/Test/TestDialect.cpp
M mlir/test/lib/Dialect/Test/TestOps.td
M mlir/test/lib/Dialect/Test/TestPatterns.cpp
M mlir/test/lib/Transforms/TestConstantFold.cpp
Log Message:
-----------
[mlir][IR] Use Listener for IR callbacks in OperationFolder
Remove the IR modification callbacks from `OperationFolder`. Instead, an optional `RewriterBase::Listener` can be specified.
* `processGeneratedConstants` => `notifyOperationCreated`
* `preReplaceAction` => `notifyOperationReplaced`
This simplifies the GreedyPatternRewriterDriver because we no longer need special handling for IR modifications due to op folding.
A folded operation is now enqueued on the GreedyPatternRewriteDriver's worklist if it was modified in-place. (There may be new patterns that apply after folding.)
Also fixes a bug in `TestOpInPlaceFold::fold`. The folder could previously be applied over and over and did not return a "null" OpFoldResult if the IR was not modified. (This is similar to a pattern that returns `success` without modifying IR; it can trigger an infinite loop in the GreedyPatternRewriteDriver.)
Differential Revision: https://reviews.llvm.org/D144463
More information about the All-commits
mailing list