[Mlir-commits] [mlir] [mlir][xegpu] adding maybe_usused for unused variable/function when assertion is off (PR #205629)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Wed Jun 24 13:00:23 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-mlir

Author: Jianhui Li (Jianhui-Li)

<details>
<summary>Changes</summary>

address the warning brought by the PR https://github.com/llvm/llvm-project/pull/203156

---
Full diff: https://github.com/llvm/llvm-project/pull/205629.diff


1 Files Affected:

- (modified) mlir/lib/Dialect/XeGPU/Transforms/XeGPULayoutImpl.cpp (+4-3) 


``````````diff
diff --git a/mlir/lib/Dialect/XeGPU/Transforms/XeGPULayoutImpl.cpp b/mlir/lib/Dialect/XeGPU/Transforms/XeGPULayoutImpl.cpp
index 2a13997aa181f..574eeabac1836 100644
--- a/mlir/lib/Dialect/XeGPU/Transforms/XeGPULayoutImpl.cpp
+++ b/mlir/lib/Dialect/XeGPU/Transforms/XeGPULayoutImpl.cpp
@@ -372,7 +372,8 @@ void xegpu::removeTemporaryLayoutAttrs(Operation *op) {
 
 /// Returns true if every dimension of `shape` except the innermost
 /// `numInnerDims` is a unit (size-1) dimension.
-static bool leadingDimsAreUnit(ArrayRef<int64_t> shape, int numInnerDims) {
+[[maybe_unused]] static bool leadingDimsAreUnit(ArrayRef<int64_t> shape,
+                                                int numInnerDims) {
   int numLeading = static_cast<int>(shape.size()) - numInnerDims;
   if (numLeading <= 0)
     return true;
@@ -1453,7 +1454,7 @@ xegpu::setupStoreNdAnchorLayout(xegpu::LayoutKind layoutKind,
   Type elemTy = srcVecTy.getElementType();
   auto subgroupSize = uArch->getSubgroupSize();
   auto dataShape = srcVecTy.getShape();
-  int rank = srcVecTy.getRank();
+  [[maybe_unused]] int rank = srcVecTy.getRank();
   assert(rank >= 2 && "Expected at least 2D shape for ND op");
 
   // Compute the default 2D block IO lane layout / lane data.
@@ -1506,7 +1507,7 @@ xegpu::setupPrefetchNdAnchorLayout(xegpu::LayoutKind layoutKind,
   Type elemTy = tdescTy.getElementType();
   auto subgroupSize = uArch->getSubgroupSize();
   auto dataShape = tdescTy.getShape();
-  int rank = tdescTy.getRank();
+  [[maybe_unused]] int rank = tdescTy.getRank();
   assert(rank >= 2 && "Expected at least 2D shape for ND op");
 
   // Compute the default 2D block IO lane layout / lane data.

``````````

</details>


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


More information about the Mlir-commits mailing list