[Mlir-commits] [mlir] ef7417f - [mlir] Fix -Wunused-but-set-variable in ModuleTranslation.cpp (NFC)

Jie Fu llvmlistbot at llvm.org
Mon Feb 26 18:39:44 PST 2024


Author: Jie Fu
Date: 2024-02-27T10:37:17+08:00
New Revision: ef7417fbc597eab1adbad4abc6ecdb2e62319513

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

LOG: [mlir] Fix -Wunused-but-set-variable in ModuleTranslation.cpp (NFC)

mlir/lib/Target/LLVMIR/ModuleTranslation.cpp:1050:11:
error: variable 'numConstantsHit' set but not used [-Werror,-Wunused-but-set-variable]
      int numConstantsHit = 0;
          ^
mlir/lib/Target/LLVMIR/ModuleTranslation.cpp:1051:11:
error: variable 'numConstantsErased' set but not used [-Werror,-Wunused-but-set-variable]
      int numConstantsErased = 0;
          ^
2 errors generated.

Added: 
    

Modified: 
    mlir/lib/Target/LLVMIR/ModuleTranslation.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp b/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
index 7cffd7bd1fa43e..a11603a44dcd1c 100644
--- a/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
+++ b/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
@@ -1047,8 +1047,8 @@ LogicalResult ModuleTranslation::convertGlobals() {
     if (Block *initializer = op.getInitializerBlock()) {
       llvm::IRBuilder<> builder(llvmModule->getContext());
 
-      int numConstantsHit = 0;
-      int numConstantsErased = 0;
+      [[maybe_unused]] int numConstantsHit = 0;
+      [[maybe_unused]] int numConstantsErased = 0;
       DenseMap<llvm::ConstantAggregate *, int> constantAggregateUseMap;
 
       for (auto &op : initializer->without_terminator()) {


        


More information about the Mlir-commits mailing list