regalloc2 icon indicating copy to clipboard operation
regalloc2 copied to clipboard

Keep all `Use`s in a single vector

Open Amanieu opened this issue 2 years ago • 0 comments

Previously, each live range would carry a list of uses in a SmallVec<[Use; 4]>, which was an inefficient use of memory.

This PR instead keeps a single Vec<Use> for all uses in a function, sorted by vreg and position. Each live range now holds a Range<u32> of indices which refer to its uses inside this vector.

Benchmarks show that this consistently improves compilation times by ~2%.

Amanieu avatar Dec 06 '23 01:12 Amanieu