Skip to content

Commit

Permalink
Add the usual check we do when inlining
Browse files Browse the repository at this point in the history
  • Loading branch information
asterite committed Jan 23, 2025
1 parent 36ff6ad commit 01ceaa3
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions compiler/noirc_evaluator/src/ssa/opt/inlining.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,16 @@ impl Ssa {
}

pub(crate) fn inline_simple_functions(mut self: Ssa) -> Ssa {
let should_inline_call = |function: &Function| {
let entry_block_id = function.entry_block();
let entry_block = &function.dfg[entry_block_id];
let should_inline_call = |callee: &Function| {
if let RuntimeType::Acir(_) = callee.runtime() {
// Functions marked to not have predicates should be preserved.
if callee.is_no_predicates() {
return false;
}
}

let entry_block_id = callee.entry_block();
let entry_block = &callee.dfg[entry_block_id];

// Only inline functions with a single block
if entry_block.successors().next().is_some() {
Expand Down

0 comments on commit 01ceaa3

Please sign in to comment.