[Mlir-commits] [mlir] [mlir][tensor] Fix tensor::PackOp fold() handling of padding (PR #87296)

Mehdi Amini llvmlistbot at llvm.org
Mon Apr 1 21:26:23 PDT 2024


================
@@ -1069,9 +1069,11 @@ void EmptyOp::getCanonicalizationPatterns(RewritePatternSet &results,
 /// Try to remove a tensor operation if it would only reshape a constant.
 /// Removes the op and replaces the constant with a new constant of the result
 /// shape.
-static OpFoldResult reshapeConstantSource(DenseElementsAttr source,
-                                          TensorType result) {
-  if (source && source.isSplat() && result.hasStaticShape())
+static OpFoldResult
+reshapeConstantSource(DenseElementsAttr source, TensorType result,
+                      std::optional<Attribute> cst = std::nullopt) {
----------------
joker-eph wrote:

Please update the documentation for this.

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


More information about the Mlir-commits mailing list