diff options
author | Alon Zakai <azakai@google.com> | 2021-11-15 16:41:53 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-16 00:41:53 +0000 |
commit | 5d398d5c9305272b971322d728c4628b38c5669c (patch) | |
tree | 6536bfe9a2f9f9bc3ca81841811428f040fa4958 | |
parent | 52696625d003f80a8ae77150b6f1e626e9d98e57 (diff) | |
download | binaryen-5d398d5c9305272b971322d728c4628b38c5669c.tar.gz binaryen-5d398d5c9305272b971322d728c4628b38c5669c.tar.bz2 binaryen-5d398d5c9305272b971322d728c4628b38c5669c.zip |
[NFC] HeapRefining => TypeRefining (#4332)
-rw-r--r-- | src/passes/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/passes/TypeRefining.cpp (renamed from src/passes/HeapRefining.cpp) | 10 | ||||
-rw-r--r-- | src/passes/pass.cpp | 6 | ||||
-rw-r--r-- | src/passes/passes.h | 2 | ||||
-rw-r--r-- | test/lit/help/optimization-opts.test | 6 | ||||
-rw-r--r-- | test/lit/passes/type-refining.wast (renamed from test/lit/passes/heap-subtyping.wast) | 2 |
6 files changed, 14 insertions, 14 deletions
diff --git a/src/passes/CMakeLists.txt b/src/passes/CMakeLists.txt index b3a7db4c9..25c9cb6b3 100644 --- a/src/passes/CMakeLists.txt +++ b/src/passes/CMakeLists.txt @@ -32,7 +32,6 @@ set(passes_SOURCES GenerateDynCalls.cpp GlobalTypeOptimization.cpp Heap2Local.cpp - HeapRefining.cpp I64ToI32Lowering.cpp Inlining.cpp InstrumentLocals.cpp @@ -81,6 +80,7 @@ set(passes_SOURCES ReorderFunctions.cpp ReReloop.cpp TrapMode.cpp + TypeRefining.cpp SafeHeap.cpp SimplifyGlobals.cpp SimplifyLocals.cpp diff --git a/src/passes/HeapRefining.cpp b/src/passes/TypeRefining.cpp index 54d6f5103..33e382bc5 100644 --- a/src/passes/HeapRefining.cpp +++ b/src/passes/TypeRefining.cpp @@ -107,12 +107,12 @@ struct FieldInfoScanner } }; -struct HeapRefining : public Pass { +struct TypeRefining : public Pass { StructUtils::StructValuesMap<FieldInfo> finalInfos; void run(PassRunner* runner, Module* module) override { if (getTypeSystem() != TypeSystem::Nominal) { - Fatal() << "HeapRefining requires nominal typing"; + Fatal() << "TypeRefining requires nominal typing"; } // Find and analyze struct operations inside each function. @@ -238,10 +238,10 @@ struct HeapRefining : public Pass { void updateTypes(Module& wasm, PassRunner* runner) { class TypeRewriter : public GlobalTypeRewriter { - HeapRefining& parent; + TypeRefining& parent; public: - TypeRewriter(Module& wasm, HeapRefining& parent) + TypeRewriter(Module& wasm, TypeRefining& parent) : GlobalTypeRewriter(wasm), parent(parent) {} void modifyStruct(HeapType oldStructType, Struct& struct_) override { @@ -267,6 +267,6 @@ struct HeapRefining : public Pass { } // anonymous namespace -Pass* createHeapRefiningPass() { return new HeapRefining(); } +Pass* createTypeRefiningPass() { return new TypeRefining(); } } // namespace wasm diff --git a/src/passes/pass.cpp b/src/passes/pass.cpp index 118b2e6ae..49615d81b 100644 --- a/src/passes/pass.cpp +++ b/src/passes/pass.cpp @@ -156,9 +156,9 @@ void PassRegistry::registerPasses() { "generate-stack-ir", "generate Stack IR", createGenerateStackIRPass); registerPass( "gto", "globally optimize GC types", createGlobalTypeOptimizationPass); - registerPass("heap-refining", + registerPass("type-refining", "apply more specific subtypes to type fields where possible", - createHeapRefiningPass); + createTypeRefiningPass); registerPass( "heap2local", "replace GC allocations with locals", createHeap2LocalPass); registerPass( @@ -527,7 +527,7 @@ void PassRunner::addDefaultGlobalOptimizationPrePasses() { } if (wasm->features.hasGC() && getTypeSystem() == TypeSystem::Nominal && options.optimizeLevel >= 2) { - addIfNoDWARFIssues("heap-refining"); + addIfNoDWARFIssues("type-refining"); // Global type optimization can remove fields that are not needed, which can // remove ref.funcs that were once assigned to vtables but are no longer // needed, which can allow more code to be removed globally. After those, diff --git a/src/passes/passes.h b/src/passes/passes.h index 365a68ad7..e8e8ecc78 100644 --- a/src/passes/passes.h +++ b/src/passes/passes.h @@ -53,7 +53,6 @@ Pass* createGenerateI64DynCallsPass(); Pass* createGenerateStackIRPass(); Pass* createGlobalTypeOptimizationPass(); Pass* createHeap2LocalPass(); -Pass* createHeapRefiningPass(); Pass* createI64ToI32LoweringPass(); Pass* createInlineMainPass(); Pass* createInliningPass(); @@ -131,6 +130,7 @@ Pass* createSSAifyPass(); Pass* createSSAifyNoMergePass(); Pass* createTrapModeClamp(); Pass* createTrapModeJS(); +Pass* createTypeRefiningPass(); Pass* createUnteePass(); Pass* createVacuumPass(); diff --git a/test/lit/help/optimization-opts.test b/test/lit/help/optimization-opts.test index 1f52b2462..af23314de 100644 --- a/test/lit/help/optimization-opts.test +++ b/test/lit/help/optimization-opts.test @@ -277,9 +277,6 @@ ;; CHECK-NEXT: ;; CHECK-NEXT: --gto globally optimize GC types ;; CHECK-NEXT: -;; CHECK-NEXT: --heap-refining apply more specific subtypes to -;; CHECK-NEXT: type fields where possible -;; CHECK-NEXT: ;; CHECK-NEXT: --heap2local replace GC allocations with ;; CHECK-NEXT: locals ;; CHECK-NEXT: @@ -522,6 +519,9 @@ ;; CHECK-NEXT: --trap-mode-js replace trapping operations with ;; CHECK-NEXT: js semantics ;; CHECK-NEXT: +;; CHECK-NEXT: --type-refining apply more specific subtypes to +;; CHECK-NEXT: type fields where possible +;; CHECK-NEXT: ;; CHECK-NEXT: --untee removes local.tees, replacing ;; CHECK-NEXT: them with sets and gets ;; CHECK-NEXT: diff --git a/test/lit/passes/heap-subtyping.wast b/test/lit/passes/type-refining.wast index 1a42d36a8..38a6319f3 100644 --- a/test/lit/passes/heap-subtyping.wast +++ b/test/lit/passes/type-refining.wast @@ -1,5 +1,5 @@ ;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited. -;; RUN: foreach %s %t wasm-opt --nominal --heap-refining -all -S -o - | filecheck %s +;; RUN: foreach %s %t wasm-opt --nominal --type-refining -all -S -o - | filecheck %s (module ;; A struct with three fields. The first will have no writes, the second one |