Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions compiler/noirc_evaluator/src/ssa/ssa_gen/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ pub(crate) fn generate_ssa(program: Program) -> Result<Ssa, RuntimeError> {
_ => unreachable!("ICE - expect return on the last block"),
}
}
// we save the data bus inside the dfg
function_context.builder.current_function.dfg.data_bus =
DataBus::get_data_bus(call_data, return_data);

// Main has now been compiled and any other functions referenced within have been added to the
// function queue as they were found in codegen_ident. This queueing will happen each time a
Expand All @@ -106,9 +109,6 @@ pub(crate) fn generate_ssa(program: Program) -> Result<Ssa, RuntimeError> {
function_context.new_function(dest_id, function);
function_context.codegen_function_body(&function.body)?;
}
// we save the data bus inside the dfg
function_context.builder.current_function.dfg.data_bus =
DataBus::get_data_bus(call_data, return_data);

Ok(function_context.builder.finish())
}
Expand Down
14 changes: 8 additions & 6 deletions test_programs/execution_success/databus/src/main.nr
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
// Test unsafe integer multiplication with overflow: 12^8 = 429 981 696
// The circuit should handle properly the growth of the bit size
use dep::std;

fn main(mut x: u32, y: call_data u32, z: call_data [u32;4] ) -> return_data u32 {

let a = z[x];
a+y
fn main(mut x: u32, y: call_data u32, z: call_data [u32;4]) -> return_data u32 {
let a = z[x];
a+foo(y)
}

// Use an unconstrained function to force the compiler to avoid inlining
unconstrained fn foo(x: u32) -> u32 {
x+1
}