diff options
author | Alon Zakai <azakai@google.com> | 2022-12-02 14:50:58 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-02 14:50:58 -0800 |
commit | 0df325188f230ddc962610376026555ac56e8e51 (patch) | |
tree | 3e512e03e728be44aabeb30035a7b741582e5a6e /test/lit/help/wasm2js.test | |
parent | 4c79085f1bc6dbf2a186af349e7a00673ecf574c (diff) | |
download | binaryen-0df325188f230ddc962610376026555ac56e8e51.tar.gz binaryen-0df325188f230ddc962610376026555ac56e8e51.tar.bz2 binaryen-0df325188f230ddc962610376026555ac56e8e51.zip |
[Wasm GC] Add TypeSSA pass (#5299)
This creates new nominal types for each (interesting) struct.new. That then allows
type-based optimizations to be more precise, as those optimizations will track
separate info for each struct.new, in effect. That is kind of like SSA, however, we
do not handle merges. For example:
x = struct.new $A (5);
print(x.value);
y = struct.new $A (11);
print(y.value);
// => //
x = struct.new $A.x (5);
print(x.value);
y = struct.new $A.y (11);
print(y.value);
After the pass runs each of those struct.new creates a unique type, and type-based
analysis can see that 5 or 11 are the only values written in that type (if nothing else
writes there).
This bloats the type section with the new subtypes, so it is best used with a pass
to merge unneeded duplicate types, which a later PR will add. That later PR will
exactly merge back in the types created here, which are nominally different but
indistinguishable otherwise.
This pass is not enabled by default. It's not clear yet where is the best place to do it,
as it must be balanced by type merging, but it might be better to do multiple
rounds of optimization between the two. Needs more investigation.
Diffstat (limited to 'test/lit/help/wasm2js.test')
-rw-r--r-- | test/lit/help/wasm2js.test | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/test/lit/help/wasm2js.test b/test/lit/help/wasm2js.test index 270f03fbf..124cd0bbe 100644 --- a/test/lit/help/wasm2js.test +++ b/test/lit/help/wasm2js.test @@ -419,6 +419,9 @@ ;; CHECK-NEXT: --type-refining apply more specific subtypes to ;; CHECK-NEXT: type fields where possible ;; CHECK-NEXT: +;; CHECK-NEXT: --type-ssa create new nominal types to help +;; CHECK-NEXT: other optimizations +;; CHECK-NEXT: ;; CHECK-NEXT: --untee removes local.tees, replacing ;; CHECK-NEXT: them with sets and gets ;; CHECK-NEXT: |