[Mlir-commits] [mlir] [mlir][linalg] Preserve encoding in `getCollapsedOpOperand` (PR #173720)

Aviad Cohen llvmlistbot at llvm.org
Sat Dec 27 21:58:21 PST 2025


================
@@ -1682,7 +1682,13 @@ static Value getCollapsedOpOperand(Location loc, LinalgOp op,
                                            operandReassociation)
         .getResult();
   }
-  return tensor::CollapseShapeOp::create(builder, loc, operand,
+  RankedTensorType operandType = cast<RankedTensorType>(operand.getType());
+  RankedTensorType collapsedType = tensor::CollapseShapeOp::inferCollapsedType(
----------------
AviadCo wrote:

I think that if we add this in `CollapseShapeOp::build` it will affect all CollapseShape ops creations, isn't it?

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


More information about the Mlir-commits mailing list