[Mlir-commits] [mlir] [MemRef] Fix -Wunused-function (PR #194366)

Aiden Grossman llvmlistbot at llvm.org
Mon Apr 27 06:24:42 PDT 2026


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

areIndicesInBounds is only used within an assert statement, so mark it
[[maybe_unused]] so that the compiler does not otherwise warn in
non-assertion builds.

>From 091aabe9ab54ccd5b47053ca24e605452041eece Mon Sep 17 00:00:00 2001
From: Aiden Grossman <aidengrossman at google.com>
Date: Mon, 27 Apr 2026 13:23:34 +0000
Subject: [PATCH] [MemRef] Fix -Wunused-function

areIndicesInBounds is only used within an assert statement, so mark it
[[maybe_unused]] so that the compiler does not otherwise warn in
non-assertion builds.
---
 mlir/lib/Dialect/MemRef/Transforms/ElideReinterpretCast.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mlir/lib/Dialect/MemRef/Transforms/ElideReinterpretCast.cpp b/mlir/lib/Dialect/MemRef/Transforms/ElideReinterpretCast.cpp
index 16b230c9d3896..41dad1384da75 100644
--- a/mlir/lib/Dialect/MemRef/Transforms/ElideReinterpretCast.cpp
+++ b/mlir/lib/Dialect/MemRef/Transforms/ElideReinterpretCast.cpp
@@ -323,7 +323,7 @@ static bool isPureRankExpansionOrCollapsingRC(memref::ReinterpretCastOp rc) {
 /// Checks statically known and constant indices accessed by a load from a pure
 /// rank expansion/collapsing to ensure in-bounds only access. Fully dynamic
 /// indices are skipped (there is no way to verify them).
-static bool areIndicesInBounds(memref::LoadOp load) {
+[[maybe_unused]] static bool areIndicesInBounds(memref::LoadOp load) {
   auto rc = load.getMemRef().getDefiningOp<memref::ReinterpretCastOp>();
   auto rcOutputTy = cast<MemRefType>(rc.getResult().getType());
 



More information about the Mlir-commits mailing list