Extract constants later so that simplify has more information

This commit is contained in:
Andrew Morris
2023-07-01 17:12:41 +10:00
parent 530c025864
commit dada0cb779
3 changed files with 20 additions and 8 deletions

View File

@@ -10,9 +10,13 @@ use super::simplify::simplify;
pub fn optimize(module: &mut Module, pointer_allocator: &mut NameAllocator) {
collapse_pointers_of_pointers(module);
extract_constants(module, pointer_allocator);
shake_tree(module);
simplify(module);
remove_noops(module);
remove_meta_lines(module);
extract_constants(module, pointer_allocator);
// After possibly repeated optimization, this ensures that the pointers are ordered correctly.
// TODO: Consider a dedicated step that's only about pointer ordering and not tree shaking.
shake_tree(module);
}