Skip to content

Commit

Permalink
Update ssa parser & tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jfecher committed Mar 7, 2025
1 parent 6bba612 commit 4e4b3bf
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1043,8 +1043,8 @@ mod test {
v19 = call f1(v5) -> u32
v20 = add v8, v19
constrain v6 == v20
dec_rc v4 v4
dec_rc v5 v5
dec_rc v4
dec_rc v5
return
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/noirc_evaluator/src/ssa/opt/constant_folding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1446,7 +1446,7 @@ mod test {
v2 = array_get v0, index u32 0 -> Field
v4 = array_get v0, index u32 1 -> Field
v5 = add v2, v4
dec_rc v0 v0
dec_rc v0
return v5
}
";
Expand Down
6 changes: 3 additions & 3 deletions compiler/noirc_evaluator/src/ssa/opt/die.rs
Original file line number Diff line number Diff line change
Expand Up @@ -838,7 +838,7 @@ mod test {
b0(v0: [Field; 2]):
inc_rc v0
v2 = array_get v0, index u32 0 -> Field
dec_rc v0 v0
dec_rc v0
return v2
}
";
Expand All @@ -862,7 +862,7 @@ mod test {
b0(v0: [Field; 2]):
inc_rc v0
v2 = array_set v0, index u32 0, value u32 0
dec_rc v0 v0
dec_rc v0
return v2
}
";
Expand Down Expand Up @@ -970,7 +970,7 @@ mod test {
v3 = load v0 -> [Field; 3]
v6 = array_set v3, index u32 0, value Field 5
store v6 at v0
dec_rc v6 v1
dec_rc v6
return
}
";
Expand Down
6 changes: 3 additions & 3 deletions compiler/noirc_evaluator/src/ssa/opt/rc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ mod test {
b0(v0: [Field; 2]):
inc_rc v0
inc_rc v0
dec_rc v0 v0
dec_rc v0
v1 = make_array [v0] : [[Field; 2]; 1]
return v1
}
Expand Down Expand Up @@ -218,7 +218,7 @@ mod test {
v2 = load v1 -> [Field; 2]
v5 = array_set v2, index u64 0, value Field 5
store v5 at v1
dec_rc v0 v0
dec_rc v0
return
}
";
Expand Down Expand Up @@ -250,7 +250,7 @@ mod test {
v5 = array_set v2, index u64 0, value Field 5
store v5 at v0
v6 = load v0 -> [Field; 2]
dec_rc v6 v1
dec_rc v1
store v6 at v0
return
}
Expand Down
4 changes: 2 additions & 2 deletions compiler/noirc_evaluator/src/ssa/opt/unrolling.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1287,7 +1287,7 @@ mod tests {
jmp b1()
b1():
v20 = load v3 -> [u64; 6]
dec_rc v0 v0
dec_rc v0
return v20
}
";
Expand Down Expand Up @@ -1463,7 +1463,7 @@ mod tests {
jmp b1(v16)
b2():
v8 = load v4 -> [u64; 6]
dec_rc v0 v0
dec_rc v0
return v8
}}
"
Expand Down
1 change: 0 additions & 1 deletion compiler/noirc_evaluator/src/ssa/parser/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ pub(crate) enum ParsedInstruction {
},
DecrementRc {
value: ParsedValue,
original: ParsedValue,
},
EnableSideEffectsIf {
condition: ParsedValue,
Expand Down
5 changes: 2 additions & 3 deletions compiler/noirc_evaluator/src/ssa/parser/into_ssa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -267,10 +267,9 @@ impl Translator {
};
self.builder.insert_constrain(lhs, rhs, assert_message);
}
ParsedInstruction::DecrementRc { value, original } => {
ParsedInstruction::DecrementRc { value } => {
let value = self.translate_value(value)?;
let original = self.translate_value(original)?;
self.builder.decrement_array_reference_count(value, original);
self.builder.decrement_array_reference_count(value);
}
ParsedInstruction::EnableSideEffectsIf { condition } => {
let condition = self.translate_value(condition)?;
Expand Down
3 changes: 1 addition & 2 deletions compiler/noirc_evaluator/src/ssa/parser/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -396,8 +396,7 @@ impl<'a> Parser<'a> {
}

let value = self.parse_value_or_error()?;
let original = self.parse_value_or_error()?;
Ok(Some(ParsedInstruction::DecrementRc { value, original }))
Ok(Some(ParsedInstruction::DecrementRc { value }))
}

fn parse_enable_side_effects(&mut self) -> ParseResult<Option<ParsedInstruction>> {
Expand Down
2 changes: 1 addition & 1 deletion compiler/noirc_evaluator/src/ssa/parser/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ fn test_dec_rc() {
let src = "
brillig(inline) fn main f0 {
b0(v0: [Field; 3]):
dec_rc v0 v0
dec_rc v0
return
}
";
Expand Down

0 comments on commit 4e4b3bf

Please sign in to comment.