[Mlir-commits] [mlir] [mlir][Linalg][Tensor] Preserve attrs on `tensor.pad` when lowering to dst-style (PR #182064)

Artem Gindinson llvmlistbot at llvm.org
Thu Feb 19 14:16:17 PST 2026


================
@@ -96,39 +97,44 @@ static Operation *movePaddingToFillOrGenericOp(RewriterBase &rewriter,
   OpBuilder::InsertionGuard g(rewriter);
   RankedTensorType resultType = padOp.getResultType();
 
-  // Examine the yielded value to decide if a linalg.generic is neede or a
+  // Collect user/dialect attributes from the pad op to preserve on the newly
+  // created ops.
+  SmallVector<NamedAttribute> preservedAttrs =
+      getPrunedAttributeList(padOp, PadOp::getAttributeNames());
+
+  // Examine the yielded value to decide if a linalg.generic is needed or a
   // linalg.fill is sufficient.
   Value yieldedValue =
       cast<tensor::YieldOp>(padOp.getBody()->getTerminator()).getValue();
   Attribute constYieldedValue;
+  const bool isConstYieldedValue =
----------------
AGindinson wrote:

Done. It's just my reflex sometimes to signify that this condition isn't reassessed further down in the code – but you're right, the convention is more important here

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


More information about the Mlir-commits mailing list