summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas Lively <tlively@google.com>2022-11-08 15:43:22 -0800
committerGitHub <noreply@github.com>2022-11-08 15:43:22 -0800
commitd7920cb9dc07a2efee8abf44d7c1a6a654a88593 (patch)
treec1d8dd9ebfb1c81edddfd156edc0c366135d200c /src
parent85ba74c8162ebf4e659a3450de0fb48a4a7141b0 (diff)
downloadbinaryen-d7920cb9dc07a2efee8abf44d7c1a6a654a88593.tar.gz
binaryen-d7920cb9dc07a2efee8abf44d7c1a6a654a88593.tar.bz2
binaryen-d7920cb9dc07a2efee8abf44d7c1a6a654a88593.zip
Fix possible-contents.h for `array.new_{data,elem}` (#5232)
* Update MemoryPacking for array.new_data The MemoryPacking pass looks at all instructions that reference memory segments to determine how they can be optimized. #5214 introduced a new instruction that references memory segments, array.new_data, but did not update MemoryPacking accordingly. This omission meant that MemoryPacking could produce invalid or misoptimized modules in the presence of array.new_data. Fix the problem by making MemoryPacking aware of array.new_data. Consider array.new_data when determining whether a segment is used and update array.new_data to reflect the new, optimized segment numberings afterward. To keep things simple, do not try to split any segment that is referred to by a array.new_data instruction. * fix * Add test explanations * Fix possible-contents.h for `array.new_{data,elem}` This code was not properly updated in #5214, so GUFA would incorrectly optimize out `array.new_data` and `array.new_elem` instructions. Fix the problem by making these instructions data flow roots. * fix * move tests
Diffstat (limited to 'src')
-rw-r--r--src/ir/possible-contents.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/ir/possible-contents.cpp b/src/ir/possible-contents.cpp
index 0c4e28568..35e87175a 100644
--- a/src/ir/possible-contents.cpp
+++ b/src/ir/possible-contents.cpp
@@ -900,6 +900,7 @@ struct InfoCollector
if (curr->type == Type::unreachable) {
return;
}
+ addRoot(curr, PossibleContents::exactType(curr->type));
auto heapType = curr->type.getHeapType();
switch (curr->op) {
case NewData: {