diff --git a/src/ion/moves.rs b/src/ion/moves.rs index 5e0abd8d..5bd8031e 100644 --- a/src/ion/moves.rs +++ b/src/ion/moves.rs @@ -796,6 +796,13 @@ impl<'a, F: Function> Env<'a, F> { for reg in this.func.inst_clobbers(inst) { redundant_moves.clear_alloc(Allocation::reg(reg)); } + // The dedicated scratch registers may be clobbered by any + // instruction. + for reg in this.env.scratch_by_class { + if let Some(reg) = reg { + redundant_moves.clear_alloc(Allocation::reg(reg)); + } + } } }