[Mlir-commits] [mlir] [mlir] Fix type transformation in DropUnitDimFromElementwiseOps (PR #75430)

Jerry Wu llvmlistbot at llvm.org
Wed Dec 13 23:54:39 PST 2023


================
@@ -1480,17 +1480,24 @@ struct DropUnitDimFromElementwiseOps final
   using OpTraitRewritePattern::OpTraitRewritePattern;
   LogicalResult matchAndRewrite(Operation *op,
                                 PatternRewriter &rewriter) const override {
-    if (op->getNumResults() != 1)
+    if (op->getNumResults() != 1 || op->getNumRegions() != 0)
----------------
pzread wrote:

I was inspired by the pattern `ReorderElementwiseOpsOnTranspose`, which does this check. I don't know if there is an elementwise op with region now, but I think it is a little more future-proof, as currently this pattern doesn't handle the op with region.

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


More information about the Mlir-commits mailing list