diff options
author | Alon Zakai <azakai@google.com> | 2023-01-31 13:07:01 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-31 13:07:01 -0800 |
commit | a6f4b00141c994c744c6cb148d3ae60f271977f6 (patch) | |
tree | c78ac8fd8d6c37e6216a820ffa79faf90a9686a4 /src | |
parent | bc2eb23da2b96201a1af416684b5929dd6a99e12 (diff) | |
download | binaryen-a6f4b00141c994c744c6cb148d3ae60f271977f6.tar.gz binaryen-a6f4b00141c994c744c6cb148d3ae60f271977f6.tar.bz2 binaryen-a6f4b00141c994c744c6cb148d3ae60f271977f6.zip |
RemoveUnusedModuleElements: Handle changes to tables (#5469)
This is a long-standing bug - we ignored the possibility of table.set in this
pass. We have few tests for this so it took a while for the fuzzer to notice it
I suppose.
Diffstat (limited to 'src')
-rw-r--r-- | src/passes/RemoveUnusedModuleElements.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/passes/RemoveUnusedModuleElements.cpp b/src/passes/RemoveUnusedModuleElements.cpp index 02aed4904..6070d8bce 100644 --- a/src/passes/RemoveUnusedModuleElements.cpp +++ b/src/passes/RemoveUnusedModuleElements.cpp @@ -101,6 +101,11 @@ struct ReferenceFinder : public PostWalker<ReferenceFinder> { void visitCallIndirect(CallIndirect* curr) { note(ModuleElement(ModuleElementKind::Table, curr->table)); + // Note a possible call of a function reference as well, as something might + // be written into the table during runtime. With precise tracking of what + // is written into the table we could do better here; we could also see + // which tables are immutable. TODO + noteCallRef(curr->heapType); } void visitCallRef(CallRef* curr) { |