[Mlir-commits] [mlir] [mlir][linalg][gpu] Clean up printing. NFC. (PR #136330)
Kazu Hirata
llvmlistbot at llvm.org
Fri Apr 18 10:44:20 PDT 2025
================
@@ -3660,17 +3661,13 @@ ParseResult MatmulOp::parse(OpAsmParser &parser, OperationState &result) {
}
void MatmulOp::print(OpAsmPrinter &p) {
- SmallVector<Attribute, 3> indexingMaps = llvm::map_to_vector(
+ SmallVector<Attribute, 3> indexingMaps = llvm::map_to_vector<3>(
MatmulOp::getDefaultIndexingMaps(getContext()),
[](AffineMap map) -> Attribute { return AffineMapAttr::get(map); });
- if (!llvm::equal(getIndexingMaps(), indexingMaps)) {
- p << " indexing_maps = [";
- llvm::interleaveComma(getIndexingMaps(), p,
- [&](Attribute attr) { p.printAttribute(attr); });
- p << "]";
- }
+ if (!llvm::equal(getIndexingMaps(), indexingMaps))
+ p << " indexing_maps = " << llvm::interleaved_array(getIndexingMaps());
----------------
kazutakahirata wrote:
Is the transformation here correct? IIUC, `llvm::interleaved_array` prints the prefix and suffix only on non-empty array inputs. In other words, do we know that `getIndexingMaps()` always return a non-empty array here? The same question applies to other places in this PR.
https://github.com/llvm/llvm-project/pull/136330
More information about the Mlir-commits
mailing list