[Mlir-commits] [mlir] [MLIR][Tensor] Perform shape inference via in-place modification (NFC) (PR #111593)

Han-Chung Wang llvmlistbot at llvm.org
Tue Oct 8 16:55:07 PDT 2024


================
@@ -4332,21 +4332,25 @@ LogicalResult PackOp::canonicalize(PackOp packOp, PatternRewriter &rewriter) {
           rewriter.create<tensor::CastOp>(loc, newSrcType, packOp.getSource());
     }
     Value dest = packOp.getDest();
-    if (destShape != packOp.getDestType().getShape()) {
+    Type originalResultType = packOp.getDestType();
----------------
hanhanW wrote:

The `getDestType` returns a RankedTensorType, so you can replace `Type` with it.

https://github.com/llvm/llvm-project/blob/04a8bffdf7b1d6e30616561de1734373375cfef5/mlir/include/mlir/Dialect/Tensor/IR/TensorOps.td#L1833-L1836

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


More information about the Mlir-commits mailing list