Skip to content

Commit

Permalink
Check that runtimes match
Browse files Browse the repository at this point in the history
  • Loading branch information
asterite committed Jan 22, 2025
1 parent 27818df commit f8ab025
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions compiler/noirc_evaluator/src/ssa/opt/inlining.rs
Original file line number Diff line number Diff line change
Expand Up @@ -892,19 +892,17 @@ impl<'function> PerFunctionContext<'function> {
}

let callee = &ssa.functions[&called_func_id];
let callee_runtime = callee.runtime();

match callee.runtime() {
RuntimeType::Acir(inline_type) => {
// If the called function is acir, we inline if it's not an entry point
if inline_type.is_entry_point() {
return None;
}
}
RuntimeType::Brillig(_) => {
if self.entry_function.runtime().is_acir() {
// We never inline a brillig function into an ACIR function.
return None;
}
// Wd never inline one runtime into another
if self.entry_function.runtime().is_acir() != callee_runtime.is_acir() {
return None;
}

if let RuntimeType::Acir(inline_type) = callee_runtime {
// If the called function is acir, we inline if it's not an entry point
if inline_type.is_entry_point() {
return None;
}
}

Expand Down

0 comments on commit f8ab025

Please sign in to comment.