summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/StringMap.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Sync the __builtin_expects for our 3 quadratically probed hash table ↵Benjamin Kramer2015-02-231-2/+3
| | | | | | | | | | | | | | | | | | implementations. This assumes that a) finding the bucket containing the value is LIKELY b) finding an empty bucket is LIKELY c) growing the table is UNLIKELY I also switched the a) and b) cases for SmallPtrSet as we seem to use the set mostly more for insertion than for checking existence. In a simple benchmark consisting of 2^21 insertions of 2^20 unique pointers into a DenseMap or SmallPtrSet a few percent speedup on average, but nothing statistically significant. llvm-svn: 230232
* Recommit 211309 (StringMap::insert), reverted in 211328 due to issues with ↵David Blaikie2014-06-231-2/+8
| | | | | | | | | | | | private, but non-deleted, move members. Certain versions of GCC (~4.7) couldn't handle the SFINAE on access control, but with "= delete" (hidden behind a macro for portability) this issue is worked around/addressed. Patch by Agustín Bergé llvm-svn: 211525
* Revert "Add StringMap::insert(pair) consistent with the standard associative ↵Rafael Espindola2014-06-201-8/+2
| | | | | | | | | | | | container concept." This reverts commit r211309. It looks like it broke some bots: http://lab.llvm.org:8011/builders/clang-x86_64-ubuntu-gdb-75/builds/15563/steps/compile/logs/stdio llvm-svn: 211328
* Add StringMap::insert(pair) consistent with the standard associative ↵David Blaikie2014-06-191-2/+8
| | | | | | | | container concept. Patch by Agustín Bergé. llvm-svn: 211309
* [C++11] Replace some comparisons with 'nullptr' with simple boolean checks ↵Craig Topper2014-04-091-3/+3
| | | | | | to reduce verbosity. llvm-svn: 205829
* [C++11] Make use of 'nullptr' in the Support library.Craig Topper2014-04-071-5/+5
| | | | llvm-svn: 205697
* Add some __builtin_expect magic to StringMap.Benjamin Kramer2012-08-291-4/+5
| | | | | | | | | Tombstones and full hash collisions are rare, mark the "empty" and "no collision" paths as likely. The bug in simplifycfg that prevented the hints from being picked during selfhost up was fixed recently :) llvm-svn: 162874
* Fix PR13148, an inf-loop in StringMap.Chandler Carruth2012-06-191-1/+1
| | | | | | | | | | | | | | | StringMap suffered from the same bug as DenseMap: when you explicitly construct it with a small number of buckets, you can arrange for the tombstone-based growth path to be followed when the number of buckets was less than '8'. In that case, even with a full map, it would compare '0' as not less than '0', and refuse to grow the table, leading to inf-loops trying to find an empty bucket on the next insertion. The fix is very simple: use '<=' as the comparison. The same fix was applied to DenseMap as well during its recent refactoring. Thanks to Alex Bolz for the great report and test case. =] llvm-svn: 158725
* Switch StringMap from an array of structures to a structure of arrays.Benjamin Kramer2011-12-271-27/+34
| | | | | | | - -25% memory usage of the main table on x86_64 (was wasted in struct padding). - no significant performance change. llvm-svn: 147294
* Reset StringMap's NumTombstones on clears and rehashes.Jakob Stoklund Olesen2011-03-301-0/+3
| | | | | | | | | | | | | StringMap was not properly updating NumTombstones after a clear or rehash. This was not fatal until now because the table was growing faster than NumTombstones could, but with the previous change of preventing infinite growth of the table the invariant (NumItems + NumTombstones <= NumBuckets) stopped being observed, causing infinite loops in certain situations. Patch by José Fonseca! llvm-svn: 128567
* Prevent infinite growth of SmallMap instances.Jakob Stoklund Olesen2011-03-301-1/+13
| | | | | | | | Rehash but don't grow when full of tombstones. Patch by José Fonseca! llvm-svn: 128565
* Change all self assignments X=X to (void)X, so that we can turn on aJeffrey Yasskin2010-12-231-1/+1
| | | | | | | new gcc warning that complains on self-assignments and self-initializations. llvm-svn: 122458
* Pass StringRef by value.Daniel Dunbar2009-11-061-3/+3
| | | | llvm-svn: 86251
* Move StringMap's string has function into StringExtras.hDaniel Dunbar2009-10-171-16/+3
| | | | llvm-svn: 84344
* Convert StringMap to using StringRef for its APIs.Daniel Dunbar2009-07-231-16/+10
| | | | | | | | | | | | - Yay for '-'s and simplifications! - I kept StringMap::GetOrCreateValue for compatibility purposes, this can eventually go away. Likewise the StringMapEntry Create functions still follow the old style. - NIFC. llvm-svn: 76888
* Remove attribution from file headers, per discussion on llvmdev.Chris Lattner2007-12-291-2/+2
| | | | llvm-svn: 45418
* stringmap memory managed with malloc nowChris Lattner2007-04-041-1/+1
| | | | llvm-svn: 35666
* use calloc instead of new/memset, it is more efficientChris Lattner2007-04-041-4/+2
| | | | llvm-svn: 35644
* Extend StringMap to support being initialized as completely empty. WhenChris Lattner2007-04-041-2/+22
| | | | | | initialized this way, they do not do a malloc to allocate their buckets. llvm-svn: 35642
* greatly reduce hte default size of stringmap.Chris Lattner2007-04-031-1/+1
| | | | llvm-svn: 35632
* Add support for removing elements out of StringMap.Chris Lattner2007-02-111-11/+52
| | | | llvm-svn: 34185
* Replace the ugly FindValue method with STL-like find methods.Chris Lattner2007-02-111-0/+43
| | | | llvm-svn: 34183
* remove support for stringmap visitors now that iterators exist.Chris Lattner2007-02-111-13/+0
| | | | llvm-svn: 34180
* add support for iterators.Chris Lattner2007-02-111-2/+9
| | | | llvm-svn: 34179
* Rename CStringMap -> StringMap, since it now supports nul characters in theChris Lattner2007-02-081-0/+138
strings. llvm-svn: 34064
OpenPOWER on IntegriCloud