[Mlir-commits] [mlir] [mlir][vector] Add pattern to reorder shape_cast(arithmetic(a, b)) (PR #74817)

Diego Caballero llvmlistbot at llvm.org
Mon Dec 11 08:28:41 PST 2023


================
@@ -1514,6 +1625,15 @@ void mlir::vector::populateShapeCastFoldingPatterns(RewritePatternSet &patterns,
   patterns.add<ShapeCastOpFolder>(patterns.getContext(), benefit);
 }
 
+void mlir::vector::populateReorderShapeCastPatterns(RewritePatternSet &patterns,
+                                                    PatternBenefit benefit) {
+  patterns.add<ReorderShapeCastWithUnitDimAndArith<arith::AddIOp>,
+               ReorderShapeCastWithUnitDimAndArith<arith::AddFOp>,
+               ReorderShapeCastWithUnitDimAndArith<arith::MulIOp>,
+               ReorderShapeCastWithUnitDimAndArith<arith::MulFOp>>(
----------------
dcaballe wrote:

Then we would only need one pattern here that would work for any elementwise op

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


More information about the Mlir-commits mailing list