From 4d179e3862a63d3d924215e75e31199369c6f3e8 Mon Sep 17 00:00:00 2001 From: Maxim Vezenov Date: Tue, 25 Jul 2023 21:27:06 +0100 Subject: [PATCH] fix: Switch from HashMap to BTreeMap in merge_stores (#2035) switch from hashMap to BTreeMap in merge_stores --- crates/noirc_evaluator/src/ssa_refactor/opt/flatten_cfg.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/noirc_evaluator/src/ssa_refactor/opt/flatten_cfg.rs b/crates/noirc_evaluator/src/ssa_refactor/opt/flatten_cfg.rs index 6ffbacf652c..f90704d3b16 100644 --- a/crates/noirc_evaluator/src/ssa_refactor/opt/flatten_cfg.rs +++ b/crates/noirc_evaluator/src/ssa_refactor/opt/flatten_cfg.rs @@ -132,7 +132,7 @@ //! v12 = add v10, v11 //! store v12 at v5 (new store) use std::{ - collections::{HashMap, HashSet}, + collections::{HashMap, HashSet, BTreeMap}, rc::Rc, }; @@ -610,7 +610,7 @@ impl<'f> Context<'f> { /// this function also needs to be changed to reflect that. fn merge_stores(&mut self, then_branch: Branch, else_branch: Branch) { // Address -> (then_value, else_value, value_before_the_if) - let mut new_map = HashMap::with_capacity(then_branch.store_values.len()); + let mut new_map = BTreeMap::new(); for (address, store) in then_branch.store_values { new_map.insert(address, (store.new_value, store.old_value, store.old_value));