[Mlir-commits] [mlir] [MLIR][Wasm] Remove statistics as they depend on global ctors (PR #153795)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Fri Aug 15 05:22:37 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-mlir

Author: Mehdi Amini (joker-eph)

<details>
<summary>Changes</summary>

Use a debug log instead for now.

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


2 Files Affected:

- (modified) mlir/lib/Target/Wasm/TranslateFromWasm.cpp (+6-10) 
- (removed) mlir/test/Target/Wasm/stats.mlir (-19) 


``````````diff
diff --git a/mlir/lib/Target/Wasm/TranslateFromWasm.cpp b/mlir/lib/Target/Wasm/TranslateFromWasm.cpp
index c23a2915ef18e..a641328e2ebde 100644
--- a/mlir/lib/Target/Wasm/TranslateFromWasm.cpp
+++ b/mlir/lib/Target/Wasm/TranslateFromWasm.cpp
@@ -30,12 +30,6 @@
 
 #define DEBUG_TYPE "wasm-translate"
 
-// Statistics.
-STATISTIC(numFunctionSectionItems, "Parsed functions");
-STATISTIC(numGlobalSectionItems, "Parsed globals");
-STATISTIC(numMemorySectionItems, "Parsed memories");
-STATISTIC(numTableSectionItems, "Parsed tables");
-
 static_assert(CHAR_BIT == 8,
               "This code expects std::byte to be exactly 8 bits");
 
@@ -1047,10 +1041,12 @@ class WasmBinaryParser {
       return;
 
     // Copy over sizes of containers into statistics.
-    numFunctionSectionItems = symbols.funcSymbols.size();
-    numGlobalSectionItems = symbols.globalSymbols.size();
-    numMemorySectionItems = symbols.memSymbols.size();
-    numTableSectionItems = symbols.tableSymbols.size();
+    LDBG() << "WASM Imports:"
+           << "\n"
+           << " - Num functions: " << symbols.funcSymbols.size() << "\n"
+           << " - Num globals: " << symbols.globalSymbols.size() << "\n"
+           << " - Num memories: " << symbols.memSymbols.size() << "\n"
+           << " - Num tables: " << symbols.tableSymbols.size();
   }
 
   ModuleOp getModule() {
diff --git a/mlir/test/Target/Wasm/stats.mlir b/mlir/test/Target/Wasm/stats.mlir
deleted file mode 100644
index b361de3d99f31..0000000000000
--- a/mlir/test/Target/Wasm/stats.mlir
+++ /dev/null
@@ -1,19 +0,0 @@
-// RUN: yaml2obj %S/inputs/stats.yaml.wasm -o - | mlir-translate --import-wasm -stats 2>&1 | FileCheck %s
-// Check that we get the correct stats for a module that has a single
-// function, table, memory, and global.
-// REQUIRES: asserts
-
-/* Source code used to create this test:
-(module
-  (type (;0;) (func (param i32) (result i32)))
-  (func (;0;) (type 0) (param i32) (result i32)
-    local.get 0)
-  (table (;0;) 2 funcref)
-  (memory (;0;) 0 65536)
-  (global (;0;) i32 (i32.const 10)))
-*/
-
-// CHECK: 1 wasm-translate - Parsed functions
-// CHECK-NEXT: 0 wasm-translate - Parsed globals
-// CHECK-NEXT: 1 wasm-translate - Parsed memories
-// CHECK-NEXT: 1 wasm-translate - Parsed tables

``````````

</details>


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


More information about the Mlir-commits mailing list