From 42b859f01df94dfffb01258b2305df8ec4d05304 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Fri, 3 Feb 2023 10:25:02 -0800 Subject: [Wasm GC] Add AbstractTypeRefining pass (#5461) If a type hierarchy has abstract classes in the middle, that is, types that are never instantiated, then we can optimize casts and other operations to them. Say in Java that we have `AbstractList`, and it only has one subclass `IntList` that is ever created, then any place we have an `AbstractList` we must actually have an `IntList`, or a null. (Or, if no subtype is instantiated, then the value must definitely be a null.) The actual implementation does a type mapping, that is, it finds all places using an abstract type and makes them refer to the single instantiated subtype (or null). After that change, no references to the abstract type remain in the program, so this both refines types and also cleans up the type section. --- test/lit/help/wasm2js.test | 3 +++ 1 file changed, 3 insertions(+) (limited to 'test/lit/help/wasm2js.test') diff --git a/test/lit/help/wasm2js.test b/test/lit/help/wasm2js.test index 501504027..502419cf2 100644 --- a/test/lit/help/wasm2js.test +++ b/test/lit/help/wasm2js.test @@ -42,6 +42,9 @@ ;; CHECK-NEXT: Optimization passes: ;; CHECK-NEXT: -------------------- ;; CHECK-NEXT: +;; CHECK-NEXT: --abstract-type-refining refine and merge abstract +;; CHECK-NEXT: (never-created) types +;; CHECK-NEXT: ;; CHECK-NEXT: --alignment-lowering lower unaligned loads and stores ;; CHECK-NEXT: to smaller aligned ones ;; CHECK-NEXT: -- cgit v1.2.3