Skip to content

Commit

Permalink
[FIX] fixed dne pass again
Browse files Browse the repository at this point in the history
  • Loading branch information
Cr0a3 committed Sep 23, 2024
1 parent 01cda39 commit d09a0d4
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/Optimizations/Passes/DeadNodeElimination.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ impl Pass for DeadNodeElimination {
fn run(&self, block: &mut crate::prelude::Block) {
for _ in 0..self.recursion_steps {
let mut used: Vec<String> = Vec::new();

let mut index = -2; // why ????? but it works for **one** tested example

let mut to_remove = vec![];

let iter = block.nodes.iter();
let iter = iter.rev();

let mut index = iter.len();

for node in iter {
let inputs = node.inputs();
let out = node.output();
Expand All @@ -41,11 +41,11 @@ impl Pass for DeadNodeElimination {
to_remove.push(index);
}
}
index += 1;

index -= 1;
}

let mut subdend = 0;
let mut subdend = 1;

for index in to_remove {
block.nodes.remove(index as usize - subdend);
Expand Down

0 comments on commit d09a0d4

Please sign in to comment.