Skip to content

Commit

Permalink
chore(ssa refactor): Add basic binary operation program (#1419)
Browse files Browse the repository at this point in the history
* make prove_and_verify method take in the experimental-ssa flag

* add new test directory for experimental-ssa

* move noir_integration code into another function and parametrize it with a boolean which will allow us to still test the normal ssa when the boolean is false, but then test the experimental ssa when true with tests in a different directory.

* add milestone 0 program

* use underscores since x and y are unused.

It just makes the CI have less information

* use convert_ssa_value to either fetch the value of a previous ValueId or create one if its a constant.

* add basic program that does binary addition

* Add a function to check whether the return type is the unit and then exit early if so

* use public abi for public parameters

* fix clippy
  • Loading branch information
kevaundray authored May 30, 2023
1 parent 50fcb3c commit 8778a1d
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[package]
authors = [""]
compiler_version = "0.1"

[dependencies]
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
x = "3"
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// The feature being tested is handling of
// a binary operation.
fn main(x : Field) -> pub Field {
x + 1
}
5 changes: 4 additions & 1 deletion crates/noirc_evaluator/src/ssa_refactor/acir_gen/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,10 @@ impl Context {
_ => unreachable!("ICE: Program must have a singular return"),
};

let is_return_unit_type = return_values.len() == 1 && dfg.type_of_value(return_values[0]) == Type::Unit;
// Check if the program returns the `Unit/None` type.
// This type signifies that the program returns nothing.
let is_return_unit_type =
return_values.len() == 1 && dfg.type_of_value(return_values[0]) == Type::Unit;
if is_return_unit_type {
return;
}
Expand Down

0 comments on commit 8778a1d

Please sign in to comment.