Handle moves by joining LRs at inst boundary, not middle of move inst
This commit is contained in:
@@ -1301,13 +1301,14 @@ impl<'a, F: Function> Env<'a, F> {
|
||||
|
||||
// If this is a move, handle specially.
|
||||
if let Some((src, dst)) = self.func.is_move(inst) {
|
||||
if src != dst {
|
||||
log::debug!(" -> move inst{}: src {} -> dst {}", inst.index(), src, dst);
|
||||
assert_eq!(src.class(), dst.class());
|
||||
|
||||
// Handle the def w.r.t. liveranges: trim the
|
||||
// start of the range and mark it dead at this
|
||||
// point in our backward scan.
|
||||
let pos = ProgPoint::after(inst);
|
||||
let pos = ProgPoint::before(inst); // See note below re: pos of use.
|
||||
let mut dst_lr = vreg_ranges[dst.vreg()];
|
||||
// If there was no liverange (dead def), create a trivial one.
|
||||
if !live.get(dst.vreg()) {
|
||||
@@ -1339,7 +1340,14 @@ impl<'a, F: Function> Env<'a, F> {
|
||||
let pos = ProgPoint::before(inst);
|
||||
let range = CodeRange {
|
||||
from: self.cfginfo.block_entry[block.index()],
|
||||
to: pos.next(),
|
||||
// Live up to end of previous inst. Because
|
||||
// the move isn't actually reading the
|
||||
// value as part of the inst, all we need
|
||||
// to do is to decide where to join the
|
||||
// LRs; and we want this to be at an inst
|
||||
// boundary, not in the middle, so that
|
||||
// the move-insertion logic remains happy.
|
||||
to: pos,
|
||||
};
|
||||
let src_lr = self.add_liverange_to_vreg(
|
||||
VRegIndex::new(src.vreg()),
|
||||
@@ -1365,6 +1373,7 @@ impl<'a, F: Function> Env<'a, F> {
|
||||
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// Process defs and uses.
|
||||
for &cur_pos in &[InstPosition::After, InstPosition::Before] {
|
||||
|
||||
Reference in New Issue
Block a user