diff --git a/src/nouveau/compiler/nak_ir.rs b/src/nouveau/compiler/nak_ir.rs index a2914b1bae5..1de9e4127c7 100644 --- a/src/nouveau/compiler/nak_ir.rs +++ b/src/nouveau/compiler/nak_ir.rs @@ -497,6 +497,10 @@ impl SSAValueAllocator { SSAValueAllocator { count: 0 } } + pub fn max_idx(&self) -> u32 { + self.count + } + pub fn alloc(&mut self, file: RegFile) -> SSAValue { self.count += 1; SSAValue::new(file, self.count) diff --git a/src/nouveau/compiler/nak_liveness.rs b/src/nouveau/compiler/nak_liveness.rs index 449abd4772f..86230f83024 100644 --- a/src/nouveau/compiler/nak_liveness.rs +++ b/src/nouveau/compiler/nak_liveness.rs @@ -311,6 +311,10 @@ impl SimpleLiveness { assert!(l.blocks.len() == func.blocks.len()); assert!(live_in.len() == func.blocks.len()); + let num_ssa = usize::try_from(func.ssa_alloc.max_idx() + 1).unwrap(); + let mut tmp = BitSet::new(); + tmp.reserve(num_ssa); + let mut to_do = true; while to_do { to_do = false; @@ -320,10 +324,13 @@ impl SimpleLiveness { to_do |= bl.live_out.union_with(&live_in[*sb_idx]); } - let new_live_in = - (bl.live_out.clone() | bl.uses.clone()) & !bl.defs.clone(); + tmp.clear(); + tmp.set_words(0..num_ssa, |w| { + (bl.live_out.get_word(w) | bl.uses.get_word(w)) + & !bl.defs.get_word(w) + }); - to_do |= live_in[b_idx].union_with(&new_live_in); + to_do |= live_in[b_idx].union_with(&tmp); } }