[Mlir-commits] [mlir] [mlir][vector] Support complete folding in single pass for vector.insert/vector.extract (PR #142124)

Yang Bai llvmlistbot at llvm.org
Mon Jun 16 06:16:09 PDT 2025


yangtetris wrote:

> Could you try changing the GreedyPatternRewriteDriver code accordingly and see if testing passes? That should probably be in a different PR.

I tried removing `addToWorklist(op);`. It works for the new tests introduced in this PR. However, simply deleting it breaks an existing pass, [SimplifyAffineStructures](https://github.com/llvm/llvm-project/blob/01f9dff61fb028f69493a44616014256dee5fb2a/mlir/include/mlir/Dialect/Affine/Passes.td#L411-L415), which depends on `GreedyPatternRewriteDriver`. 

Take the following MLIR example:
```
func.func @test_gaussian_elimination_empty_set0() {
  affine.for %arg0 = 1 to 10 {
    affine.for %arg1 = 1 to 100 {
      // CHECK-NOT: affine.if
      affine.if affine_set<(d0, d1) : (2 == 0)>(%arg0, %arg1) {
        func.call @external() : () -> ()
      }
    }
  }
  return
}
```
The `affine.if` op needed to be processed again after being folded in this case. 

In this case, the `affine.if` op needs to be processed again after being folded.

I’m wondering if it makes sense to add a new field like `bool recursiveProcessModifiedOp` to [GreedyRewriteConfig](https://github.com/llvm/llvm-project/blob/01f9dff61fb028f69493a44616014256dee5fb2a/mlir/include/mlir/Transforms/GreedyPatternRewriteDriver.h#L43-L151) to handle this scenario?

https://github.com/llvm/llvm-project/pull/142124


More information about the Mlir-commits mailing list