Skip to content

Commit ac865b1

Browse files
authored
fix: Only flatten main (#1984)
1 parent 2f6741f commit ac865b1

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

crates/noirc_evaluator/src/ssa_refactor/opt/flatten_cfg.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -157,16 +157,14 @@ use crate::ssa_refactor::{
157157
mod branch_analysis;
158158

159159
impl Ssa {
160-
/// Flattens the control flow graph of each function such that the function is left with a
160+
/// Flattens the control flow graph of main such that the function is left with a
161161
/// single block containing all instructions and no more control-flow.
162162
///
163163
/// This pass will modify any instructions with side effects in particular, often multiplying
164164
/// them by jump conditions to maintain correctness even when all branches of a jmpif are inlined.
165165
/// For more information, see the module-level comment at the top of this file.
166166
pub(crate) fn flatten_cfg(mut self) -> Ssa {
167-
for function in self.functions.values_mut() {
168-
flatten_function_cfg(function);
169-
}
167+
flatten_function_cfg(self.main_mut());
170168
self
171169
}
172170
}

0 commit comments

Comments
 (0)