Skip to content

Commit

Permalink
fix(ssa refactor): fix bad constant type caching (#1593)
Browse files Browse the repository at this point in the history
  • Loading branch information
joss-aztec committed Jun 7, 2023
1 parent 053dba0 commit 37c0be6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions crates/noirc_evaluator/src/ssa_refactor/ir/dfg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<FieldElement, ValueId>,
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

Check warning on line 48 in crates/noirc_evaluator/src/ssa_refactor/ir/dfg.rs

View workflow job for this annotation

GitHub Actions / Spellcheck / Spellcheck

Unknown word (uniqued)

Check warning on line 48 in crates/noirc_evaluator/src/ssa_refactor/ir/dfg.rs

View workflow job for this annotation

GitHub Actions / Spellcheck / Spellcheck

Unknown word (uniqued)
Expand Down Expand Up @@ -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
}

Expand Down

0 comments on commit 37c0be6

Please sign in to comment.