Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for multiple OperandConstraint::Reuse operands. #180

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions src/ion/liveranges.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}
}

Expand Down Expand Up @@ -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)
}
Expand Down
Loading