llvm/unittests
Fiona Glaser 33ae313f2a 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@263522 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-15 01:50:46 +00:00
..
ADT DenseMap: make .resize() do the intuitive thing 2016-03-15 01:50:46 +00:00
Analysis [LoopUnroll] Convert some existing tests to unit-tests. 2016-03-12 01:28:56 +00:00
AsmParser [AsmParser] Expose an API to parse a string starting with a type. 2016-03-08 00:37:07 +00:00
Bitcode Remove autoconf support 2016-01-26 21:29:08 +00:00
CodeGen Remove autoconf support 2016-01-26 21:29:08 +00:00
DebugInfo [DebugInfoPDB] Add source / line number accessors for PDB. 2016-02-18 18:47:29 +00:00
ExecutionEngine [RuntimeDyld] Fix '_' stripping in RTDyldMemoryManager::getSymbolAddressInProcess. 2016-03-03 21:23:15 +00:00
IR Remove some unused variables 2016-03-13 22:00:18 +00:00
LineEditor Remove autoconf support 2016-01-26 21:29:08 +00:00
Linker Delete the deprecated LLVMLinkModules. 2016-02-12 15:28:45 +00:00
MC Move ObjectYAML code to a new library. 2016-03-01 19:15:06 +00:00
MI Make a stub version of MITests, instead of reverting. 2016-02-18 07:37:17 +00:00
ObjectYAML Move ObjectYAML code to a new library. 2016-03-01 19:15:06 +00:00
Option Remove autoconf support 2016-01-26 21:29:08 +00:00
ProfileData Remove code added for debugging purposes. NFC. 2016-03-14 22:23:28 +00:00
Support MathExtrasTest.cpp: Use EXPECT_DOUBLE_EQ here, instead of EXPECT_FLOAT_EQ. 2016-03-14 23:11:28 +00:00
Transforms Really fix ASAN leak/etc issues with MemorySSA unittests 2016-03-02 21:16:28 +00:00
CMakeLists.txt Move ObjectYAML code to a new library. 2016-03-01 19:15:06 +00:00