summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas Lively <7121787+tlively@users.noreply.github.com>2022-06-10 11:24:48 -0700
committerGitHub <noreply@github.com>2022-06-10 11:24:48 -0700
commit9fbfe0f200f716a6c9a045c6a3f2606b99af8dea (patch)
tree06b2ea8641eb526805e7b7f1de43b713203580d5 /src
parent0b66981d0e3aa958877b5c04769e75836497b4c0 (diff)
downloadbinaryen-9fbfe0f200f716a6c9a045c6a3f2606b99af8dea.tar.gz
binaryen-9fbfe0f200f716a6c9a045c6a3f2606b99af8dea.tar.bz2
binaryen-9fbfe0f200f716a6c9a045c6a3f2606b99af8dea.zip
Include globals when collecting module types (#4717)
Otherwise when a type is only used on a global, it will be incorrectly omitted from the output.
Diffstat (limited to 'src')
-rw-r--r--src/ir/module-utils.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/ir/module-utils.cpp b/src/ir/module-utils.cpp
index bf1a45205..38bb6f3d9 100644
--- a/src/ir/module-utils.cpp
+++ b/src/ir/module-utils.cpp
@@ -104,6 +104,9 @@ Counts getHeapTypeCounts(Module& wasm) {
// Collect module-level info.
Counts counts;
CodeScanner(wasm, counts).walkModuleCode(&wasm);
+ for (auto& curr : wasm.globals) {
+ counts.note(curr->type);
+ }
for (auto& curr : wasm.tags) {
counts.note(curr->sig);
}