This pattern is useful when we have extract->compute->insert op
patterns inside loops and the extract/insert offsets/sizes/strides
are all loop invariant. Such op patterns can be generated via,
for example, unrolling tiled loops.
It would be good to unify the impl. and helper functions with lib/Dialect/Linalg/Transforms/Hoisting.cpp and/or bufferization and explicitly disallow having multiple different implementations (e.g. findMatchingExtractSlice or something very close must already exist somewhere, please refactor as you need to have 1 version that we can later evolve into an analysis or interface).
Adding @ThomasRaoux to weigh in since he wrote the hoisting.cpp part.
Please suffix this file name with Patterns -> HoistExtractInsertSlicePatterns.cpp
@nicolasvasilache: sure thing. I'll chat with Thomas to see how we can clean up these. I suspect we can disentangle the logic in Hoisting.cpp, which right now does both tensor and vector hoisting. We should be able to rely on this new pattern for tensor specifically and make vector side simpler. (Both side needs similar analysis, which we can also try to see how to unify.)