[Mlir-commits] [mlir] [MLIR][Wasm] Remove statistics as they depend on global ctors (PR #153795)
Mehdi Amini
llvmlistbot at llvm.org
Fri Aug 15 05:22:06 PDT 2025
https://github.com/joker-eph created https://github.com/llvm/llvm-project/pull/153795
Use a debug log instead for now.
>From 5d0257e56ccf9be77e223d65113fd9cb0afa1850 Mon Sep 17 00:00:00 2001
From: Mehdi Amini <joker.eph at gmail.com>
Date: Fri, 15 Aug 2025 05:19:03 -0700
Subject: [PATCH] [MLIR][Wasm] Remove statistics as they depend on global ctors
Use a debug log instead for now.
---
mlir/lib/Target/Wasm/TranslateFromWasm.cpp | 16 ++++++----------
mlir/test/Target/Wasm/stats.mlir | 19 -------------------
2 files changed, 6 insertions(+), 29 deletions(-)
delete mode 100644 mlir/test/Target/Wasm/stats.mlir
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
More information about the Mlir-commits
mailing list