Skip to content

Commit bcfc10c

Browse files
authored
Fix fallback-split behavior: trim start of minimal bundle wrt start of original LR. (#85)
When a liverange starts at a *late* point of an instruction, and it undergoes the fallback "split into all minimal pieces" transform, we end up creating one minimal bundle that starts at the *early* point of the instruction at the start of the original LR. This can create impossible-to-allocate situations where a fixed-constraint LR overlaps another constrained to the same register (e.g. at calls). We fix this by ensuring the minimal bundle is trimmed only to the half of the instruction that overlaps the original LR. This is analogous to the third fix in #74, but on the other end (start of LR rather than end of it).
1 parent 0fb9c03 commit bcfc10c

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

src/ion/process.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -800,6 +800,7 @@ impl<'a, F: Function> Env<'a, F> {
800800
for entry_idx in 0..self.bundles[bundle.index()].ranges.len() {
801801
// Iterate manually; don't borrow `self`.
802802
let entry = self.bundles[bundle.index()].ranges[entry_idx];
803+
let lr_from = entry.range.from;
803804
let lr_to = entry.range.to;
804805

805806
removed_lrs.insert(entry.index);
@@ -863,6 +864,7 @@ impl<'a, F: Function> Env<'a, F> {
863864

864865
// Otherwise, create a new LR.
865866
let pos = ProgPoint::before(u.pos.inst());
867+
let pos = std::cmp::max(lr_from, pos);
866868
let cr = CodeRange { from: pos, to };
867869
let lr = self.create_liverange(cr);
868870
new_lrs.push((vreg, lr));

0 commit comments

Comments
 (0)