bytecodealliance / regalloc2

A new register allocator
Apache License 2.0
218 stars 39 forks source link

Keep all `Use`s in a single vector #172

Open Amanieu opened 12 months ago

Amanieu commented 12 months ago

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%.