about summary refs log tree commit diff
path: root/src/rustllvm/PassWrapper.cpp
diff options
context:
space:
mode:
authorNicholas Nethercote <nnethercote@mozilla.com>2018-06-28 16:20:32 +1000
committerNicholas Nethercote <nnethercote@mozilla.com>2018-06-29 09:57:19 +1000
commit08683f003cab472efc0481c349cb69dfb137c4c1 (patch)
tree097f92369e0b42064adef34924d2485e59a022aa /src/rustllvm/PassWrapper.cpp
parent99a9d6806d355b69fa66621df5208342de823aea (diff)
downloadrust-08683f003cab472efc0481c349cb69dfb137c4c1.tar.gz
rust-08683f003cab472efc0481c349cb69dfb137c4c1.zip
Rename `IdxSet::clone_from`.
The current situation is something of a mess.

- `IdxSetBuf` derefs to `IdxSet`.
- `IdxSetBuf` implements `Clone`, and therefore has a provided `clone_from`
  method, which does allocation and so is expensive.
- `IdxSet` has a `clone_from` method that is non-allocating and therefore
  cheap, but this method is not from the `Clone` trait.

As a result, if you have an `IdxSetBuf` called `b`, if you call
`b.clone_from(b2)` you'll get the expensive `IdxSetBuf` method, but if you call
`(*b).clone_from(b2)` you'll get the cheap `IdxSetBuf` method.
`liveness_of_locals()` does the former, presumably unintentionally, and
therefore does lots of unnecessary allocations.

Having a `clone_from` method that isn't from the `Clone` trait is a bad idea in
general, so this patch renames it as `overwrite`. This avoids the unnecessary
allocations in `liveness_of_locals()`, speeding up most NLL benchmarks, the
best by 1.5%. It also means that calls of the form `(*b).clone_from(b2)` can be
rewritten as `b.overwrite(b2)`.
Diffstat (limited to 'src/rustllvm/PassWrapper.cpp')
0 files changed, 0 insertions, 0 deletions