From edecfeeb1f852fd234ed458881f976f1820ac9d6 Mon Sep 17 00:00:00 2001 From: Andrew Morris Date: Sat, 1 Jul 2023 17:57:18 +1000 Subject: [PATCH] Do some repeated optimization --- valuescript_compiler/src/optimization/optimize.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/valuescript_compiler/src/optimization/optimize.rs b/valuescript_compiler/src/optimization/optimize.rs index 3614a1f..6aa75fa 100644 --- a/valuescript_compiler/src/optimization/optimize.rs +++ b/valuescript_compiler/src/optimization/optimize.rs @@ -11,9 +11,12 @@ use super::simplify::simplify; pub fn optimize(module: &mut Module, pointer_allocator: &mut NameAllocator) { collapse_pointers_of_pointers(module); shake_tree(module); - simplify(module); - simplify(module); - remove_noops(module); + + for _ in 0..2 { + simplify(module); + remove_noops(module); + } + remove_meta_lines(module); extract_constants(module, pointer_allocator);