summaryrefslogtreecommitdiff
path: root/scripts/clang-format-diff.sh
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2023-02-01 10:01:08 -0800
committerGitHub <noreply@github.com>2023-02-01 10:01:08 -0800
commit71b4ba4711189a26b699061e5b2af665ccc93114 (patch)
tree7fb045fe4b3889c08e4ac3153b4a4d384099f751 /scripts/clang-format-diff.sh
parenta6f4b00141c994c744c6cb148d3ae60f271977f6 (diff)
downloadbinaryen-71b4ba4711189a26b699061e5b2af665ccc93114.tar.gz
binaryen-71b4ba4711189a26b699061e5b2af665ccc93114.tar.bz2
binaryen-71b4ba4711189a26b699061e5b2af665ccc93114.zip
RemoveUnusedModuleElements: Optimize unread struct.new fields (#5445)
This is similar to the existing optimization for function references: a RefFunc is just a reference, and we do not consider the function actually used unless some CallRef can actually call it. Here we optimize StructNew fields by tracking if they are read. Consider this object: (struct.new $object (global.get $vtable) ) Before this PR, when we saw that StructNew we'd make that global used, and process all of its contents, which look like this: (global $vtable (struct.new $object (ref.func $foo) ) ) With this PR we track which fields on the struct types are even read. If they are not then we do not add uses of the things they refer to. In this example, the global vtable would be referenced, but not used, and likewise the RefFunc inside it. The technical way we handle this is to walk StructNews carefully: when we see a field that has been read, we can just read it normally, but if it has not been read then we note it on the side, and only process it later if we see a read.
Diffstat (limited to 'scripts/clang-format-diff.sh')
0 files changed, 0 insertions, 0 deletions