Don't generate r1->scratch,scratch-r1 sequence for cyclic moves of r1->r1 that are generated to change vreg ownership and keep the checker happy. Seems to eliminate a bit of braindeadness and improve bz2 by ~5-10%.

This commit is contained in:
Chris Fallin
2021-05-26 21:35:43 -07:00
parent 13bde99d7d
commit 7171624750

View File

@@ -4254,11 +4254,18 @@ impl<'a, F: Function> Env<'a, F> {
// regs, but this seems simpler.) // regs, but this seems simpler.)
let mut int_moves: SmallVec<[InsertedMove; 8]> = smallvec![]; let mut int_moves: SmallVec<[InsertedMove; 8]> = smallvec![];
let mut float_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 { for m in moves {
if m.from_alloc.is_reg() && m.to_alloc.is_reg() { if m.from_alloc.is_reg() && m.to_alloc.is_reg() {
assert_eq!(m.from_alloc.class(), m.to_alloc.class()); 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() { match m.from_alloc.class() {
RegClass::Int => { RegClass::Int => {
int_moves.push(m.clone()); 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 for &(regclass, moves) in
&[(RegClass::Int, &int_moves), (RegClass::Float, &float_moves)] &[(RegClass::Int, &int_moves), (RegClass::Float, &float_moves)]
{ {