[Mlir-commits] [mlir] 2a044f8 - [MLIR] Add [[maybe_unused]] to variables on used in assert (#123037)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Wed Jan 15 02:22:05 PST 2025


Author: Will Froom
Date: 2025-01-15T10:22:02Z
New Revision: 2a044f8a092efb27fa1837f953bce8237d41e59b

URL: https://github.com/llvm/llvm-project/commit/2a044f8a092efb27fa1837f953bce8237d41e59b
DIFF: https://github.com/llvm/llvm-project/commit/2a044f8a092efb27fa1837f953bce8237d41e59b.diff

LOG: [MLIR] Add [[maybe_unused]] to variables on used in assert (#123037)

Add [[maybe_unused]] to suppresses warnings when  `-NDEBUG` is enabled

Added: 
    

Modified: 
    mlir/lib/Dialect/Vector/Transforms/VectorEmulateNarrowType.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Dialect/Vector/Transforms/VectorEmulateNarrowType.cpp b/mlir/lib/Dialect/Vector/Transforms/VectorEmulateNarrowType.cpp
index a674a590091815..95064083b21d44 100644
--- a/mlir/lib/Dialect/Vector/Transforms/VectorEmulateNarrowType.cpp
+++ b/mlir/lib/Dialect/Vector/Transforms/VectorEmulateNarrowType.cpp
@@ -1291,7 +1291,7 @@ using ExtractNBitsFn =
 /// bitwise ops to avoid leaving LLVM to scramble with peephole optimizations.
 static Value rewriteI4ToI8Ext(PatternRewriter &rewriter, Location loc,
                               Value srcValue, const ExtractNBitsFn &extFn) {
-  auto srcVecType = cast<VectorType>(srcValue.getType());
+  [[maybe_unused]] auto srcVecType = cast<VectorType>(srcValue.getType());
   assert(srcVecType.getElementType().isSignlessInteger(4) &&
          "Expected i4 type");
 
@@ -1311,7 +1311,7 @@ static Value rewriteI4ToI8Ext(PatternRewriter &rewriter, Location loc,
 /// bitwise ops to avoid leaving LLVM to scramble with peephole optimizations.
 static Value rewriteI2ToI8Ext(PatternRewriter &rewriter, Location loc,
                               Value srcValue, const ExtractNBitsFn &extFn) {
-  VectorType srcVecType = cast<VectorType>(srcValue.getType());
+  [[maybe_unused]] VectorType srcVecType = cast<VectorType>(srcValue.getType());
   assert(srcVecType.getElementType().isSignlessInteger(2) &&
          "Expected i2 type");
 


        


More information about the Mlir-commits mailing list