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

Andrzej Warzyński llvmlistbot at llvm.org
Thu Dec 14 04:48:51 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)
----------------
banach-space wrote:

I skipped this check because I couldn't find an example for which it would be required :) But I also couldn't find anything that would guarantee that "elementwise" will have no regions 🤷🏻. Anyway, this is fine and like you said - makes things future-proof.

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


More information about the Mlir-commits mailing list