Fiona Glaser 750f1d0625 DenseMap: make .resize() do the intuitive thing
In some places, like InstCombine, we resize a DenseMap to fit the elements
we intend to put in it, then insert those elements (to avoid continual
reallocations as it grows). But .resize(foo) doesn't actually do what
people think; it resizes to foo buckets (which is really an
implementation detail the user of DenseMap probably shouldn't care about),
not the space required to fit foo elements. DenseMap grows if 3/4 of its
buckets are full, so this actually causes one forced reallocation every
time instead of avoiding a reallocation.

This patch makes .resize(foo) do the intuitive thing: it grows to the size
necessary to fit foo elements without new allocations.

Also include a test to verify that .resize() actually does what we think it
does.

llvm-svn: 263522
2016-03-15 01:50:46 +00:00
..
2016-01-26 21:29:08 +00:00
2016-01-26 21:29:08 +00:00
2016-03-13 22:00:18 +00:00
2016-01-26 21:29:08 +00:00
2016-03-01 19:15:06 +00:00
2016-01-26 21:29:08 +00:00