[Mlir-commits] [mlir] [mlir][NFC] Remove internal linkage from reshape op helper templates (PR #214759)

Aditya Medhane llvmlistbot at llvm.org
Fri Aug 7 07:38:43 PDT 2026


https://github.com/flash1729 created https://github.com/llvm/llvm-project/pull/214759

Another case of the cleanup done for #208001, which enabled -Wunused-template under -Wall. Both helpers are `static` in ReshapeOpsUtils.h, which reaches many TUs via Linalg.h, Tensor.h and MemRef.h, so clang warns wherever they are not instantiated. Dropping `static` gives them vague linkage.

>From 662cfdea015df31721467568f94bcc213ab0bef4 Mon Sep 17 00:00:00 2001
From: flash1729 <sherlockedaditya at gmail.com>
Date: Fri, 7 Aug 2026 15:20:27 +0530
Subject: [PATCH] [mlir][NFC] Remove internal linkage from reshape op helper
 templates

Another case of the cleanup done for #208001, which enabled -Wunused-template
under -Wall. Both helpers are `static` in ReshapeOpsUtils.h, which reaches many
TUs via Linalg.h, Tensor.h and MemRef.h, so clang warns wherever they are not
instantiated. Dropping `static` gives them vague linkage.
---
 mlir/include/mlir/Dialect/Utils/ReshapeOpsUtils.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/mlir/include/mlir/Dialect/Utils/ReshapeOpsUtils.h b/mlir/include/mlir/Dialect/Utils/ReshapeOpsUtils.h
index 2e8c0e269995e..6f58ed48fd64f 100644
--- a/mlir/include/mlir/Dialect/Utils/ReshapeOpsUtils.h
+++ b/mlir/include/mlir/Dialect/Utils/ReshapeOpsUtils.h
@@ -84,8 +84,8 @@ bool isReassociationValid(ArrayRef<AffineMap> reassociation,
                           int *invalidIndex = nullptr);
 
 template <typename ReshapeOpTy, typename InverseReshapeOpTy>
-static OpFoldResult foldReshapeOp(ReshapeOpTy reshapeOp,
-                                  ArrayRef<Attribute> operands) {
+OpFoldResult foldReshapeOp(ReshapeOpTy reshapeOp,
+                           ArrayRef<Attribute> operands) {
   // Fold identity reshape.
   if (reshapeOp.getSrcType() == reshapeOp.getType())
     return reshapeOp.getSrc();
@@ -140,8 +140,8 @@ static OpFoldResult foldReshapeOp(ReshapeOpTy reshapeOp,
 /// Common verifier for reshape-like types. Fills `expandedType` and
 ///`collapsedType` with the proper `src` or `result` type.
 template <typename Op, typename T>
-static LogicalResult verifyReshapeLikeTypes(Op op, T expandedType,
-                                            T collapsedType, bool isExpansion) {
+LogicalResult verifyReshapeLikeTypes(Op op, T expandedType, T collapsedType,
+                                     bool isExpansion) {
 
   unsigned expandedRank = expandedType.getRank();
   unsigned collapsedRank = collapsedType.getRank();



More information about the Mlir-commits mailing list