Merge pull request #21 from cfallin/fuzzbug-20211204

Fix fuzzbug: add checker metadata for new vreg on multi-fixed-reg fixup move.
This commit is contained in:
Chris Fallin
2021-12-05 09:56:37 -08:00
committed by GitHub
3 changed files with 8 additions and 6 deletions

View File

@@ -331,7 +331,7 @@ pub struct Env<'a, F: Function> {
// was to the approprate PReg. // was to the approprate PReg.
// //
// (progpoint, copy-from-preg, copy-to-preg, to-slot) // (progpoint, copy-from-preg, copy-to-preg, to-slot)
pub multi_fixed_reg_fixups: Vec<(ProgPoint, PRegIndex, PRegIndex, usize)>, pub multi_fixed_reg_fixups: Vec<(ProgPoint, PRegIndex, PRegIndex, VRegIndex, usize)>,
pub inserted_moves: Vec<InsertedMove>, pub inserted_moves: Vec<InsertedMove>,

View File

@@ -1167,6 +1167,7 @@ impl<'a, F: Function> Env<'a, F> {
ProgPoint, ProgPoint,
PRegIndex, PRegIndex,
PRegIndex, PRegIndex,
VRegIndex,
usize, usize,
)>| { )>| {
if last_point.is_some() && Some(pos) != last_point { if last_point.is_some() && Some(pos) != last_point {
@@ -1189,7 +1190,7 @@ impl<'a, F: Function> Env<'a, F> {
let orig_preg = first_preg[idx]; let orig_preg = first_preg[idx];
if orig_preg != preg_idx { if orig_preg != preg_idx {
log::trace!(" -> duplicate; switching to constraint Reg"); log::trace!(" -> duplicate; switching to constraint Reg");
fixups.push((pos, orig_preg, preg_idx, slot)); fixups.push((pos, orig_preg, preg_idx, vreg_idx, slot));
*op = Operand::new( *op = Operand::new(
op.vreg(), op.vreg(),
OperandConstraint::Reg, OperandConstraint::Reg,

View File

@@ -685,21 +685,22 @@ impl<'a, F: Function> Env<'a, F> {
} }
// Handle multi-fixed-reg constraints by copying. // Handle multi-fixed-reg constraints by copying.
for (progpoint, from_preg, to_preg, slot) in for (progpoint, from_preg, to_preg, to_vreg, slot) in
std::mem::replace(&mut self.multi_fixed_reg_fixups, vec![]) std::mem::replace(&mut self.multi_fixed_reg_fixups, vec![])
{ {
log::trace!( log::trace!(
"multi-fixed-move constraint at {:?} from p{} to p{}", "multi-fixed-move constraint at {:?} from p{} to p{} for v{}",
progpoint, progpoint,
from_preg.index(), from_preg.index(),
to_preg.index() to_preg.index(),
to_vreg.index(),
); );
self.insert_move( self.insert_move(
progpoint, progpoint,
InsertMovePrio::MultiFixedReg, InsertMovePrio::MultiFixedReg,
Allocation::reg(self.pregs[from_preg.index()].reg), Allocation::reg(self.pregs[from_preg.index()].reg),
Allocation::reg(self.pregs[to_preg.index()].reg), Allocation::reg(self.pregs[to_preg.index()].reg),
None, Some(self.vreg_regs[to_vreg.index()]),
); );
self.set_alloc( self.set_alloc(
progpoint.inst(), progpoint.inst(),