From 0551101da1580f254a039b4bb5f3d75fd2c9db41 Mon Sep 17 00:00:00 2001 From: vezenovm Date: Fri, 29 Mar 2024 19:43:38 +0000 Subject: [PATCH] reuse is_entry_point helper on RuntimeType and remove some unnecessary clones --- compiler/noirc_evaluator/src/ssa.rs | 4 +--- compiler/noirc_evaluator/src/ssa/opt/inlining.rs | 13 ++++++------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/compiler/noirc_evaluator/src/ssa.rs b/compiler/noirc_evaluator/src/ssa.rs index 59f2bdc6f84..52377d36b36 100644 --- a/compiler/noirc_evaluator/src/ssa.rs +++ b/compiler/noirc_evaluator/src/ssa.rs @@ -174,8 +174,6 @@ fn convert_generated_acir_into_circuit( .. } = generated_acir; - let locations = locations.clone(); - let (public_parameter_witnesses, private_parameters) = split_public_and_private_inputs(&func_sig, &input_witnesses); @@ -189,7 +187,7 @@ fn convert_generated_acir_into_circuit( private_parameters, public_parameters, return_values, - assert_messages: assert_messages.clone().into_iter().collect(), + assert_messages: assert_messages.into_iter().collect(), recursive, }; diff --git a/compiler/noirc_evaluator/src/ssa/opt/inlining.rs b/compiler/noirc_evaluator/src/ssa/opt/inlining.rs index 7c7698d236d..63c78b99cdf 100644 --- a/compiler/noirc_evaluator/src/ssa/opt/inlining.rs +++ b/compiler/noirc_evaluator/src/ssa/opt/inlining.rs @@ -11,7 +11,7 @@ use crate::ssa::{ ir::{ basic_block::BasicBlockId, dfg::{CallStack, InsertInstructionResult}, - function::{Function, FunctionId, InlineType, RuntimeType}, + function::{Function, FunctionId}, instruction::{Instruction, InstructionId, TerminatorInstruction}, value::{Value, ValueId}, }, @@ -351,14 +351,13 @@ impl<'function> PerFunctionContext<'function> { for id in block.instructions() { match &self.source_function.dfg[*id] { Instruction::Call { func, arguments } => match self.get_function(*func) { - Some(function) => match ssa.functions[&function].runtime() { - RuntimeType::Acir(InlineType::Inline) => { - self.inline_function(ssa, *id, function, arguments); - } - RuntimeType::Acir(InlineType::Fold) | RuntimeType::Brillig => { + Some(function) => { + if ssa.functions[&function].runtime().is_entry_point() { self.push_instruction(*id); + } else { + self.inline_function(ssa, *id, function, arguments); } - }, + } None => self.push_instruction(*id), }, _ => self.push_instruction(*id),