diff options
author | Thomas Lively <tlively@google.com> | 2024-09-05 13:42:05 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-05 20:42:05 +0000 |
commit | a64037480b83373953292469c1fa1f80ec80e13c (patch) | |
tree | 1a9f9d976ce873e14803d979e0164ee4b1b1fda6 /src | |
parent | fbbdc64a5bf69d47bab5a33b6ec148e9b79a6a84 (diff) | |
download | binaryen-a64037480b83373953292469c1fa1f80ec80e13c.tar.gz binaryen-a64037480b83373953292469c1fa1f80ec80e13c.tar.bz2 binaryen-a64037480b83373953292469c1fa1f80ec80e13c.zip |
Fix supertype counts when collecting heap types (#6905)
We previous incremented the use count for a declared supertype only if
it was also a type we had never seen before. Fix the count by treating
the supertype the same as any other type used in a type definition.
Update tests accordingly, including by manually moving input types
around to better match the output.
Diffstat (limited to 'src')
-rw-r--r-- | src/ir/module-utils.cpp | 13 |
1 files changed, 1 insertions, 12 deletions
diff --git a/src/ir/module-utils.cpp b/src/ir/module-utils.cpp index e0bd9592a..3c81d6679 100644 --- a/src/ir/module-utils.cpp +++ b/src/ir/module-utils.cpp @@ -506,9 +506,7 @@ InsertOrderedMap<HeapType, HeapTypeInfo> collectHeapTypeInfo( while (!newTypes.empty()) { while (!newTypes.empty()) { auto ht = newTypes.pop(); - // TODO: Use getReferencedHeapTypes instead and remove separate - // consideration of supertypes below. - for (HeapType child : ht.getHeapTypeChildren()) { + for (HeapType child : ht.getReferencedHeapTypes()) { if (!child.isBasic()) { if (!info.contains(child)) { noteNewType(child); @@ -517,15 +515,6 @@ InsertOrderedMap<HeapType, HeapTypeInfo> collectHeapTypeInfo( } } - if (auto super = ht.getDeclaredSuperType()) { - if (!info.contains(*super)) { - noteNewType(*super); - // TODO: This should be unconditional for the count to be correct, but - // this will be moot once we use getReferencedHeapTypes above. - info.note(*super); - } - } - // Make sure we've noted the complete recursion group of each type as // well. if (inclusion != TypeInclusion::UsedIRTypes) { |