Some fuzzbug fixes

This commit is contained in:
Chris Fallin
2021-06-09 20:58:54 -07:00
parent e33790d8e7
commit f898b8dcbd

View File

@@ -644,6 +644,7 @@ enum InsertMovePrio {
InEdgeMoves, InEdgeMoves,
BlockParam, BlockParam,
Regular, Regular,
PostRegular,
MultiFixedReg, MultiFixedReg,
ReusedInput, ReusedInput,
OutEdgeMoves, OutEdgeMoves,
@@ -892,7 +893,7 @@ impl RedundantMoveEliminator {
}; };
log::debug!(" -> elide {}", elide); log::debug!(" -> elide {}", elide);
let def_alloc = if dst_vreg != existing_dst_vreg && dst_vreg.is_some() && elide { let def_alloc = if dst_vreg != existing_dst_vreg && dst_vreg.is_some() {
Some((to, dst_vreg.unwrap())) Some((to, dst_vreg.unwrap()))
} else { } else {
None None
@@ -1560,15 +1561,15 @@ impl<'a, F: Function> Env<'a, F> {
// again. This is used by the // again. This is used by the
// checker. // checker.
self.insert_move( self.insert_move(
ProgPoint::before(inst), ProgPoint::after(inst),
InsertMovePrio::MultiFixedReg, InsertMovePrio::Regular,
Allocation::reg(preg), Allocation::reg(preg),
Allocation::reg(preg), Allocation::reg(preg),
Some(dst.vreg()), Some(dst.vreg()),
); );
self.insert_move( self.insert_move(
ProgPoint::after(inst), ProgPoint::before(inst.next()),
InsertMovePrio::Regular, InsertMovePrio::MultiFixedReg,
Allocation::reg(preg), Allocation::reg(preg),
Allocation::reg(preg), Allocation::reg(preg),
Some(src.vreg()), Some(src.vreg()),
@@ -1597,7 +1598,7 @@ impl<'a, F: Function> Env<'a, F> {
// the checker. // the checker.
self.insert_move( self.insert_move(
ProgPoint::after(inst), ProgPoint::after(inst),
InsertMovePrio::Regular, InsertMovePrio::BlockParam,
Allocation::reg(preg), Allocation::reg(preg),
Allocation::reg(preg), Allocation::reg(preg),
Some(dst.vreg()), Some(dst.vreg()),
@@ -1625,8 +1626,8 @@ impl<'a, F: Function> Env<'a, F> {
// preg, not the vreg. This is // preg, not the vreg. This is
// used by the checker. // used by the checker.
self.insert_move( self.insert_move(
ProgPoint::after(inst), ProgPoint::before(inst.next()),
InsertMovePrio::Regular, InsertMovePrio::PostRegular,
Allocation::reg(preg), Allocation::reg(preg),
Allocation::reg(preg), Allocation::reg(preg),
Some(dst.vreg()), Some(dst.vreg()),
@@ -4077,7 +4078,7 @@ impl<'a, F: Function> Env<'a, F> {
InsertMovePrio::Regular, InsertMovePrio::Regular,
prev_alloc, prev_alloc,
alloc, alloc,
Some(self.vreg_regs[vreg.index()]), None,
); );
} }
} }
@@ -4737,14 +4738,6 @@ impl<'a, F: Function> Env<'a, F> {
} }
} }
for m in &self_moves {
let action = redundant_moves.process_move(m.from_alloc, m.to_alloc, m.to_vreg);
assert!(action.elide);
if let Some((alloc, vreg)) = action.def_alloc {
self.add_edit(pos, prio, Edit::DefAlloc { alloc, vreg });
}
}
for &(regclass, moves) in for &(regclass, moves) in
&[(RegClass::Int, &int_moves), (RegClass::Float, &float_moves)] &[(RegClass::Int, &int_moves), (RegClass::Float, &float_moves)]
{ {
@@ -4790,6 +4783,23 @@ impl<'a, F: Function> Env<'a, F> {
} }
} }
} }
for m in &self_moves {
log::debug!(
"self move at pos {:?} prio {:?}: {} -> {} to_vreg {:?}",
pos,
prio,
m.from_alloc,
m.to_alloc,
m.to_vreg
);
let action = redundant_moves.process_move(m.from_alloc, m.to_alloc, m.to_vreg);
assert!(action.elide);
if let Some((alloc, vreg)) = action.def_alloc {
log::debug!(" -> DefAlloc: alloc {} vreg {}", alloc, vreg);
self.add_edit(pos, prio, Edit::DefAlloc { alloc, vreg });
}
}
} }
// Add edits to describe blockparam locations too. This is // Add edits to describe blockparam locations too. This is