diff --git a/src/ion/mod.rs b/src/ion/mod.rs index 105b964..ed2b7ce 100644 --- a/src/ion/mod.rs +++ b/src/ion/mod.rs @@ -4254,11 +4254,18 @@ impl<'a, F: Function> Env<'a, F> { // regs, but this seems simpler.) let mut int_moves: SmallVec<[InsertedMove; 8]> = smallvec![]; let mut float_moves: SmallVec<[InsertedMove; 8]> = smallvec![]; + let mut self_moves: SmallVec<[InsertedMove; 8]> = smallvec![]; for m in moves { if m.from_alloc.is_reg() && m.to_alloc.is_reg() { assert_eq!(m.from_alloc.class(), m.to_alloc.class()); } + if m.from_alloc == m.to_alloc { + if m.to_vreg.is_some() { + self_moves.push(m.clone()); + } + continue; + } match m.from_alloc.class() { RegClass::Int => { int_moves.push(m.clone()); @@ -4269,6 +4276,18 @@ impl<'a, F: Function> Env<'a, F> { } } + for m in &self_moves { + self.add_edit( + pos, + prio, + Edit::Move { + from: m.from_alloc, + to: m.to_alloc, + to_vreg: m.to_vreg, + }, + ); + } + for &(regclass, moves) in &[(RegClass::Int, &int_moves), (RegClass::Float, &float_moves)] {