[Mlir-commits] [mlir] [mlir][vector] Add pattern to rewrite contiguous ExtractStridedSlice into Extract (PR #111541)

Benoit Jacob llvmlistbot at llvm.org
Tue Oct 8 13:26:32 PDT 2024


================
@@ -235,6 +235,11 @@ void populateVectorExtractStridedSliceToExtractInsertChainPatterns(
     std::function<bool(ExtractStridedSliceOp)> controlFn = nullptr,
     PatternBenefit benefit = 1);
 
+/// Pattern to rewrite simple cases of N-D extract_strided_slice, where the
+/// slice is contiguous, into extract and shape_cast.
+void populateVectorContiguousExtractStridedSliceToExtractPatterns(
+    RewritePatternSet &patterns, PatternBenefit benefit = 1);
----------------
bjacob wrote:

Sorry @joker-eph, I mis-parsed your question --- read "is"  instead of "isn't".

No opinion about whether this should be a "canonicalization".  I wasn't too sure that I wanted to enter that debate; my pattern is replacing 1 op with 2 ops so I expected a nontrivial debate. Feel free!

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


More information about the Mlir-commits mailing list