From a7863f2ef2a773d4c81d757a542b32282988f4f2 Mon Sep 17 00:00:00 2001 From: Joss Date: Wed, 7 Jun 2023 17:01:58 +0100 Subject: [PATCH] fix(ssa refactor): fix bad constant type caching --- crates/noirc_evaluator/src/ssa_refactor/ir/dfg.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/noirc_evaluator/src/ssa_refactor/ir/dfg.rs b/crates/noirc_evaluator/src/ssa_refactor/ir/dfg.rs index 42835c1946d..47872b7468a 100644 --- a/crates/noirc_evaluator/src/ssa_refactor/ir/dfg.rs +++ b/crates/noirc_evaluator/src/ssa_refactor/ir/dfg.rs @@ -42,7 +42,7 @@ pub(crate) struct DataFlowGraph { /// Each constant is unique, attempting to insert the same constant /// twice will return the same ValueId. - constants: HashMap, + constants: HashMap<(FieldElement, Type), ValueId>, /// Contains each function that has been imported into the current function. /// Each function's Value::Function is uniqued here so any given FunctionId @@ -164,11 +164,11 @@ impl DataFlowGraph { /// Creates a new constant value, or returns the Id to an existing one if /// one already exists. pub(crate) fn make_constant(&mut self, constant: FieldElement, typ: Type) -> ValueId { - if let Some(id) = self.constants.get(&constant) { + if let Some(id) = self.constants.get(&(constant, typ)) { return *id; } let id = self.values.insert(Value::NumericConstant { constant, typ }); - self.constants.insert(constant, id); + self.constants.insert((constant, typ), id); id }