[all-commits] [llvm/llvm-project] 0e4735: [mlir] Fix worklist bug in MultiOpPatternRewriteDr...

Matthias Springer via All-commits all-commits at lists.llvm.org
Tue Jan 10 06:39:50 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 0e4735546e6bbcfd5d11d0a6b8b68cb9ccad9b41
      https://github.com/llvm/llvm-project/commit/0e4735546e6bbcfd5d11d0a6b8b68cb9ccad9b41
  Author: Matthias Springer <springerm at google.com>
  Date:   2023-01-10 (Tue, 10 Jan 2023)

  Changed paths:
    M mlir/lib/Transforms/Utils/GreedyPatternRewriteDriver.cpp
    M mlir/test/Transforms/test-strict-pattern-driver.mlir
    M mlir/test/lib/Dialect/Test/TestPatterns.cpp

  Log Message:
  -----------
  [mlir] Fix worklist bug in MultiOpPatternRewriteDriver

When `strict = true`, only pre-existing and newly-created ops are rewritten and/or folded. Such ops are stored in `strictModeFilteredOps`.

Newly-created ops were previously added to `strictModeFilteredOps` after calling `addToWorklist` (via `GreedyPatternRewriteDriver::notifyOperationInserted`). Therefore, newly-created ops were never added to the worklist.

Also fix a test case that should have gone into an infinite loop (`test.replace_with_new_op` was replaced with itself, which should have caused the op to be rewritten over and over), but did not due to this bug.

Differential Revision: https://reviews.llvm.org/D141141




More information about the All-commits mailing list