From a113d39fe87e098c5b19ca75002b6995a3f69e3e Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Wed, 10 Nov 2021 13:40:34 -0800 Subject: Add GlobalSubtyping pass (#4306) This specializes the fields of structs based on the types written to them. That is, if a field is of type A but in practice we always write some subtype B to it then we can change the type of the field to that. On j2wasm this manages to improve at least one field in 2% of types. Not a large amount, but this does lead to further benefits in later opts (e.g. about a third of the improvements are to turn a field non-nullable). --- test/lit/help/optimization-opts.test | 3 +++ 1 file changed, 3 insertions(+) (limited to 'test/lit/help/optimization-opts.test') diff --git a/test/lit/help/optimization-opts.test b/test/lit/help/optimization-opts.test index 34559ab0a..380101a53 100644 --- a/test/lit/help/optimization-opts.test +++ b/test/lit/help/optimization-opts.test @@ -275,6 +275,9 @@ ;; CHECK-NEXT: ;; CHECK-NEXT: --generate-stack-ir generate Stack IR ;; CHECK-NEXT: +;; CHECK-NEXT: --global-subtyping apply more specific subtypes to +;; CHECK-NEXT: type fields where possible +;; CHECK-NEXT: ;; CHECK-NEXT: --gto globally optimize GC types ;; CHECK-NEXT: ;; CHECK-NEXT: --heap2local replace GC allocations with -- cgit v1.2.3