From ab3c0a40c479f31658a97ac150d9fe668e07ae51 Mon Sep 17 00:00:00 2001 From: Iizerd <47404005+Iizerd@users.noreply.github.com> Date: Thu, 18 Jul 2024 10:12:10 -0700 Subject: [PATCH] Added support for multiple OperandConstraint::Reuse operands. whoopsies. double whoopsies. --- src/ion/liveranges.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/ion/liveranges.rs b/src/ion/liveranges.rs index b3ee32cb..a66f8269 100644 --- a/src/ion/liveranges.rs +++ b/src/ion/liveranges.rs @@ -460,15 +460,14 @@ impl<'a, F: Function> Env<'a, F> { // Does the instruction have any input-reusing // outputs? This is important below to establish // proper interference wrt other inputs. We note the - // *vreg* that is reused, not the index. - let mut reused_input = None; + // *vreg*s that are reused, not the index. + let mut reused_inputs: SmallVec<[VReg; 4]> = smallvec![]; for op in self.func.inst_operands(inst) { if let OperandConstraint::Reuse(i) = op.constraint() { debug_assert!(self.func.inst_operands(inst)[i] .as_fixed_nonallocatable() .is_none()); - reused_input = Some(self.func.inst_operands(inst)[i].vreg()); - break; + reused_inputs.push(self.func.inst_operands(inst)[i].vreg()) } } @@ -592,8 +591,8 @@ impl<'a, F: Function> Env<'a, F> { // the other inputs and the // input-that-is-reused/output. (OperandKind::Use, OperandPos::Early) - if reused_input.is_some() - && reused_input.unwrap() != operand.vreg() => + if !reused_inputs.is_empty() + && !reused_inputs.contains(&operand.vreg()) => { ProgPoint::after(inst) }