Skip to content

Commit

Permalink
feat: parallelize DIE pass (#9933)
Browse files Browse the repository at this point in the history
We can parallelize the DIE pass across different functions to speed up
this pass.
  • Loading branch information
TomAFrench authored and stevenplatt committed Nov 13, 2024
1 parent 59389fb commit 5afcc11
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions noir/noir-repo/compiler/noirc_evaluator/src/ssa/opt/die.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
use fxhash::{FxHashMap as HashMap, FxHashSet as HashSet};
use im::Vector;
use noirc_errors::Location;
use rayon::iter::{IntoParallelRefMutIterator, ParallelIterator};

use crate::ssa::{
ir::{
Expand All @@ -24,9 +25,8 @@ impl Ssa {
/// unused results.
#[tracing::instrument(level = "trace", skip(self))]
pub(crate) fn dead_instruction_elimination(mut self) -> Ssa {
for function in self.functions.values_mut() {
function.dead_instruction_elimination(true);
}
self.functions.par_iter_mut().for_each(|(_, func)| func.dead_instruction_elimination(true));

self
}
}
Expand Down

0 comments on commit 5afcc11

Please sign in to comment.