Skip to content

Commit

Permalink
chore: Use is_entry_point helper on RuntimeType (#4678)
Browse files Browse the repository at this point in the history
…y clones

# Description

## Problem\*

Resolves <!-- Link to GitHub Issue -->

## Summary\*

I just noticed a place that a spot was missed in inlining where
`RuntimeType::is_entry_point` could be used rather than matching on
`RuntimeType`. This is also better cause it stays in line with the
filter for `get_entry_point_functions`.

## Additional Context



## Documentation\*

Check one:
- [ ] No documentation needed.
- [ ] Documentation included in this PR.
- [ ] **[For Experimental Features]** Documentation to be submitted in a
separate PR.

# PR Checklist\*

- [ ] I have tested the changes locally.
- [ ] I have formatted the changes with [Prettier](https://prettier.io/)
and/or `cargo fmt` on default settings.
  • Loading branch information
vezenovm authored and TomAFrench committed Apr 3, 2024
1 parent 7eda3a8 commit 203e5b2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
4 changes: 1 addition & 3 deletions compiler/noirc_evaluator/src/ssa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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,
};

Expand Down
13 changes: 6 additions & 7 deletions compiler/noirc_evaluator/src/ssa/opt/inlining.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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},
},
Expand Down Expand Up @@ -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),
Expand Down

0 comments on commit 203e5b2

Please sign in to comment.