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
5 changes: 3 additions & 2 deletions crates/noirc_evaluator/src/ssa/acir_gen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,9 @@ impl Acir {
ins: &Instruction,
evaluator: &mut Evaluator,
ctx: &SsaContext,
) {
) -> Result<(), RuntimeErrorKind> {
if ins.operation == Operation::Nop {
return;
return Ok(());
}

let mut output = match &ins.operation {
Expand Down Expand Up @@ -233,6 +233,7 @@ impl Acir {
};
output.id = Some(ins.id);
self.arith_cache.insert(ins.id, output);
Ok(())
}

fn get_predicate(
Expand Down
7 changes: 4 additions & 3 deletions crates/noirc_evaluator/src/ssa/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,7 @@ impl SsaContext {
integer::overflow_strategy(self)?;
self.log(enable_logging, "\noverflow:", "");
//ACIR
self.acir(evaluator);
self.acir(evaluator)?;
if enable_logging {
Acir::print_circuit(&evaluator.gates);
println!("DONE");
Expand All @@ -703,17 +703,18 @@ impl SsaContext {
Ok(())
}

pub fn acir(&self, evaluator: &mut Evaluator) {
pub fn acir(&self, evaluator: &mut Evaluator) -> Result<(), RuntimeError> {
let mut acir = Acir::default();
let mut fb = Some(&self[self.first_block]);
while let Some(block) = fb {
for iter in &block.instructions {
let ins = self.get_instruction(*iter);
acir.evaluate_instruction(ins, evaluator, self);
acir.evaluate_instruction(ins, evaluator, self).map_err(RuntimeError::from)?;
}
//TODO we should rather follow the jumps
fb = block.left.map(|block_id| &self[block_id]);
}
Ok(())
}

pub fn generate_empty_phi(&mut self, target_block: BlockId, phi_root: NodeId) -> NodeId {
Expand Down