diff --git a/src/nouveau/compiler/nak_calc_instr_deps.rs b/src/nouveau/compiler/nak_calc_instr_deps.rs index 2b2a3a2c913..250658c0d05 100644 --- a/src/nouveau/compiler/nak_calc_instr_deps.rs +++ b/src/nouveau/compiler/nak_calc_instr_deps.rs @@ -155,12 +155,12 @@ impl AllocBarriers { continue; } - if instr.num_srcs() > 0 { + if !instr.srcs().is_empty() { let bar = self.alloc_barrier(); instr.deps.set_rd_bar(bar.try_into().unwrap()); self.set_instr_read_barrier(instr, bar); } - if instr.num_dsts() > 0 { + if !instr.dsts().is_empty() { let bar = self.alloc_barrier(); instr.deps.set_wr_bar(bar.try_into().unwrap()); self.set_instr_write_barrier(instr, bar); diff --git a/src/nouveau/compiler/nak_ir.rs b/src/nouveau/compiler/nak_ir.rs index 8dc28d6a124..532ee613447 100644 --- a/src/nouveau/compiler/nak_ir.rs +++ b/src/nouveau/compiler/nak_ir.rs @@ -1200,7 +1200,7 @@ impl Shader { } Opcode::SPLIT => { let comps = u8::try_from(instr.num_dsts()).unwrap(); - if instr.num_dsts() == 1 { + if comps == 1 { let src = instr.src(0); let dst = instr.dst(0); Instr::new_mov(*dst, *src) @@ -1221,13 +1221,12 @@ impl Shader { } Opcode::FS_OUT => { let mut instrs = Vec::new(); - for i in 0..instr.num_srcs() { + for (i, src) in instr.srcs().iter().enumerate() { let dst = Ref::new_reg( RegFile::GPR, i.try_into().unwrap(), 1, ); - let src = instr.src(i); instrs.push(Instr::new_mov(dst, *src)); } Instr::new_meta(instrs)