From a095e87492c1dde24151c2cce54efd01ba39f7fe Mon Sep 17 00:00:00 2001 From: Heejin Ahn Date: Sat, 23 May 2026 01:46:24 +0000 Subject: [PATCH] [wasm-split] Scan trapping globals if custom descriptors is enabled We don't need to compute effects for all global initializers unless custom-descriptors is not enabled. Should have done this with #8742. --- src/ir/module-splitting.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/ir/module-splitting.cpp b/src/ir/module-splitting.cpp index 27b7302c105..78141676375 100644 --- a/src/ir/module-splitting.cpp +++ b/src/ir/module-splitting.cpp @@ -791,13 +791,16 @@ void ModuleSplitter::shareImportableItems() { primaryUsed.globals.insert(tableManager.activeBase.global); } - // Trapping globals should stay in the primary module to preserve the trapping - // behavior upon instantiation. - for (auto& global : primary.globals) { - if (global->init && - EffectAnalyzer(config.passOptions, primary, global->init) - .hasUnremovableSideEffects()) { - primaryUsed.globals.insert(global->name); + // If custom-descirptors is enabled, global initializers can trap. Trapping + // globals should stay in the primary module to preserve the trapping behavior + // upon instantiation. + if (primary.features.hasCustomDescriptors()) { + for (auto& global : primary.globals) { + if (global->init && + EffectAnalyzer(config.passOptions, primary, global->init) + .hasUnremovableSideEffects()) { + primaryUsed.globals.insert(global->name); + } } }