[Mlir-commits] [mlir] [mlir][Interfaces] Fix -Wunused-function (PR #196314)

Aiden Grossman llvmlistbot at llvm.org
Thu May 7 06:27:07 PDT 2026


https://github.com/boomanaiden154 created https://github.com/llvm/llvm-project/pull/196314

These functions are only used inside assert statements, so mark them
[[maybe_unused]] to prevent -Wunused-function when they are used in a
non-asserts build.

>From 4a605507e80bc332ab0fa14d2a9f144552fdec13 Mon Sep 17 00:00:00 2001
From: Aiden Grossman <aidengrossman at google.com>
Date: Thu, 7 May 2026 13:25:32 +0000
Subject: [PATCH] [mlir][Interfaces] Fix -Wunused-function

These functions are only used inside assert statements, so mark them
[[maybe_unused]] to prevent -Wunused-function when they are used in a
non-asserts build.
---
 mlir/lib/Dialect/Arith/Transforms/ReifyValueBounds.cpp | 3 ++-
 mlir/lib/Interfaces/ValueBoundsOpInterface.cpp         | 5 +++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/mlir/lib/Dialect/Arith/Transforms/ReifyValueBounds.cpp b/mlir/lib/Dialect/Arith/Transforms/ReifyValueBounds.cpp
index 6f02575767e8e..8a46762eb8e05 100644
--- a/mlir/lib/Dialect/Arith/Transforms/ReifyValueBounds.cpp
+++ b/mlir/lib/Dialect/Arith/Transforms/ReifyValueBounds.cpp
@@ -18,7 +18,8 @@
 using namespace mlir;
 using namespace mlir::arith;
 
-static bool isIndexLikeType(Type type, ValueBoundsOptions options) {
+[[maybe_unused]] static bool isIndexLikeType(Type type,
+                                             ValueBoundsOptions options) {
   return type.isIndex() || (options.allowIntegerType && type.isInteger());
 }
 
diff --git a/mlir/lib/Interfaces/ValueBoundsOpInterface.cpp b/mlir/lib/Interfaces/ValueBoundsOpInterface.cpp
index 02579673d2293..b2b33b7441c37 100644
--- a/mlir/lib/Interfaces/ValueBoundsOpInterface.cpp
+++ b/mlir/lib/Interfaces/ValueBoundsOpInterface.cpp
@@ -77,11 +77,12 @@ static std::optional<int64_t> getConstantIntValue(OpFoldResult ofr) {
   return std::nullopt;
 }
 
-static bool isIndexOrIntegerType(Type type) {
+[[maybe_unused]] static bool isIndexOrIntegerType(Type type) {
   return type.isIndex() || type.isInteger();
 }
 
-static bool isIndexLikeType(Type type, ValueBoundsOptions options) {
+[[maybe_unused]] static bool isIndexLikeType(Type type,
+                                             ValueBoundsOptions options) {
   return type.isIndex() || (options.allowIntegerType && type.isInteger());
 }
 



More information about the Mlir-commits mailing list