Skip to content

Commit

Permalink
feat!: Drop support for the legacy SSA (#2049)
Browse files Browse the repository at this point in the history
* feat!: Drop support for the legacy SSA

* chore: fix compilation error

* fully remove aos_to_soa methods and a couple compilation errors for extra flag on check_crate

---------

Co-authored-by: vezenovm <[email protected]>
  • Loading branch information
TomAFrench and vezenovm authored Jul 26, 2023
1 parent 4378bb8 commit 3f33e44
Show file tree
Hide file tree
Showing 49 changed files with 52 additions and 12,456 deletions.
4 changes: 0 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions crates/lsp/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ fn on_code_lens_request(

// We ignore the warnings and errors produced by compilation for producing codelenses
// because we can still get the test functions even if compilation fails
let _ = check_crate(&mut context, crate_id, false, false);
let _ = check_crate(&mut context, crate_id, false);

let fm = &context.file_manager;
let files = fm.as_simple_files();
Expand Down Expand Up @@ -287,7 +287,7 @@ fn on_did_save_text_document(

let mut diagnostics = Vec::new();

let file_diagnostics = match check_crate(&mut context, crate_id, false, false) {
let file_diagnostics = match check_crate(&mut context, crate_id, false) {
Ok(warnings) => warnings,
Err(errors_and_warnings) => errors_and_warnings,
};
Expand Down
4 changes: 2 additions & 2 deletions crates/lsp/src/lib_hacky.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ pub fn on_code_lens_request(

// We ignore the warnings and errors produced by compilation for producing codelenses
// because we can still get the test functions even if compilation fails
let _ = check_crate(&mut context, crate_id, false, false);
let _ = check_crate(&mut context, crate_id, false);

let fm = &context.file_manager;
let files = fm.as_simple_files();
Expand Down Expand Up @@ -206,7 +206,7 @@ pub fn on_did_save_text_document(
Ok(res) => res,
};

let file_diagnostics = match check_crate(&mut context, crate_id, false, false) {
let file_diagnostics = match check_crate(&mut context, crate_id, false) {
Ok(warnings) => warnings,
Err(errors_and_warnings) => errors_and_warnings,
};
Expand Down
11 changes: 2 additions & 9 deletions crates/nargo_cli/src/cli/check_cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,7 @@ fn check_from_path<B: Backend>(
compile_options: &CompileOptions,
) -> Result<(), CliError<B>> {
let (mut context, crate_id) = resolve_root_manifest(program_dir, None)?;
check_crate_and_report_errors(
&mut context,
crate_id,
compile_options.deny_warnings,
compile_options.legacy_ssa,
)?;
check_crate_and_report_errors(&mut context, crate_id, compile_options.deny_warnings)?;

// XXX: We can have a --overwrite flag to determine if you want to overwrite the Prover/Verifier.toml files
if let Some((parameters, return_type)) = compute_function_signature(&context, &crate_id) {
Expand Down Expand Up @@ -220,9 +215,7 @@ pub(crate) fn check_crate_and_report_errors(
context: &mut Context,
crate_id: CrateId,
deny_warnings: bool,
legacy_ssa: bool,
) -> Result<(), ReportedErrors> {
let result =
check_crate(context, crate_id, deny_warnings, legacy_ssa).map(|warnings| ((), warnings));
let result = check_crate(context, crate_id, deny_warnings).map(|warnings| ((), warnings));
super::compile_cmd::report_errors(result, context, deny_warnings)
}
2 changes: 1 addition & 1 deletion crates/nargo_cli/src/cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ mod tests {
let mut context = Context::new(fm, graph);
let crate_id = create_local_crate(&mut context, root_file, CrateType::Binary);

let result = check_crate(&mut context, crate_id, false, false);
let result = check_crate(&mut context, crate_id, false);
let success = result.is_ok();

let errors = match result {
Expand Down
7 changes: 1 addition & 6 deletions crates/nargo_cli/src/cli/test_cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,7 @@ fn run_tests<B: Backend>(
compile_options: &CompileOptions,
) -> Result<(), CliError<B>> {
let (mut context, crate_id) = resolve_root_manifest(program_dir, None)?;
check_crate_and_report_errors(
&mut context,
crate_id,
compile_options.deny_warnings,
compile_options.legacy_ssa,
)?;
check_crate_and_report_errors(&mut context, crate_id, compile_options.deny_warnings)?;

let test_functions = match context.crate_graph.crate_type(crate_id) {
noirc_frontend::graph::CrateType::Workspace => {
Expand Down
21 changes: 5 additions & 16 deletions crates/noirc_driver/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ use clap::Args;
use fm::FileId;
use noirc_abi::FunctionSignature;
use noirc_errors::{CustomDiagnostic, FileDiagnostic};
use noirc_evaluator::legacy_create_circuit;
use noirc_evaluator::ssa_refactor::create_circuit;
use noirc_evaluator::create_circuit;
use noirc_frontend::graph::{CrateId, CrateName, CrateType};
use noirc_frontend::hir::def_map::{Contract, CrateDefMap};
use noirc_frontend::hir::Context;
Expand Down Expand Up @@ -39,10 +38,6 @@ pub struct CompileOptions {
/// Treat all warnings as errors
#[arg(short, long)]
pub deny_warnings: bool,

/// Compile and optimize using the old deprecated SSA pass
#[arg(long)]
pub legacy_ssa: bool,
}

/// Helper type used to signify where only warnings are expected in file diagnostics
Expand Down Expand Up @@ -132,7 +127,6 @@ pub fn check_crate(
context: &mut Context,
crate_id: CrateId,
deny_warnings: bool,
legacy_ssa: bool,
) -> Result<Warnings, ErrorsAndWarnings> {
// Add the stdlib before we check the crate
// TODO: This should actually be done when constructing the driver and then propagated to each dependency when added;
Expand All @@ -147,8 +141,6 @@ pub fn check_crate(
let std_crate = context.crate_graph.add_stdlib(CrateType::Library, root_file_id);
propagate_dep(context, std_crate, &CrateName::new(std_crate_name).unwrap());

context.def_interner.legacy_ssa = legacy_ssa;

let mut errors = vec![];
match context.crate_graph.crate_type(crate_id) {
CrateType::Workspace => {
Expand Down Expand Up @@ -187,7 +179,7 @@ pub fn compile_main(
crate_id: CrateId,
options: &CompileOptions,
) -> Result<(CompiledProgram, Warnings), ErrorsAndWarnings> {
let warnings = check_crate(context, crate_id, options.deny_warnings, options.legacy_ssa)?;
let warnings = check_crate(context, crate_id, options.deny_warnings)?;

let main = match context.get_main_function(&crate_id) {
Some(m) => m,
Expand Down Expand Up @@ -216,7 +208,7 @@ pub fn compile_contracts(
crate_id: CrateId,
options: &CompileOptions,
) -> Result<(Vec<CompiledContract>, Warnings), ErrorsAndWarnings> {
let warnings = check_crate(context, crate_id, options.deny_warnings, options.legacy_ssa)?;
let warnings = check_crate(context, crate_id, options.deny_warnings)?;

let contracts = context.get_all_contracts(&crate_id);
let mut compiled_contracts = vec![];
Expand Down Expand Up @@ -310,11 +302,8 @@ pub fn compile_no_check(
) -> Result<CompiledProgram, FileDiagnostic> {
let program = monomorphize(main_function, &context.def_interner);

let (circuit, debug, abi) = if options.legacy_ssa {
legacy_create_circuit(program, options.show_ssa, show_output)?
} else {
create_circuit(program, options.show_ssa, options.show_brillig, show_output)?
};
let (circuit, debug, abi) =
create_circuit(program, options.show_ssa, options.show_brillig, show_output)?;

Ok(CompiledProgram { circuit, debug, abi })
}
5 changes: 0 additions & 5 deletions crates/noirc_evaluator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,7 @@ noirc_frontend.workspace = true
noirc_errors.workspace = true
noirc_abi.workspace = true
acvm.workspace = true
arena.workspace = true
iter-extended.workspace = true
thiserror.workspace = true
num-bigint = "0.4"
num-traits = "0.2.8"
im = "15.1"

[dev-dependencies]
rand="0.8.5"
Loading

0 comments on commit 3f33e44

Please sign in to comment.