summaryrefslogtreecommitdiff
path: root/lib/Support/StringMap.cpp
Commit message (Collapse)AuthorAge
* Add some __builtin_expect magic to StringMap.Benjamin Kramer2012-08-29
| | | | | | | | | 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 :) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162874 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix PR13148, an inf-loop in StringMap.Chandler Carruth2012-06-19
| | | | | | | | | | | | | | | 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. =] git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158725 91177308-0d34-0410-b5e6-96231b3b80d8
* Switch StringMap from an array of structures to a structure of arrays.Benjamin Kramer2011-12-27
| | | | | | | - -25% memory usage of the main table on x86_64 (was wasted in struct padding). - no significant performance change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147294 91177308-0d34-0410-b5e6-96231b3b80d8
* Reset StringMap's NumTombstones on clears and rehashes.Jakob Stoklund Olesen2011-03-30
| | | | | | | | | | | | | 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! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128567 91177308-0d34-0410-b5e6-96231b3b80d8
* Prevent infinite growth of SmallMap instances.Jakob Stoklund Olesen2011-03-30
| | | | | | | | Rehash but don't grow when full of tombstones. Patch by José Fonseca! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128565 91177308-0d34-0410-b5e6-96231b3b80d8
* Change all self assignments X=X to (void)X, so that we can turn on aJeffrey Yasskin2010-12-23
| | | | | | | | | new gcc warning that complains on self-assignments and self-initializations. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122458 91177308-0d34-0410-b5e6-96231b3b80d8
* Pass StringRef by value.Daniel Dunbar2009-11-06
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86251 91177308-0d34-0410-b5e6-96231b3b80d8
* Move StringMap's string has function into StringExtras.hDaniel Dunbar2009-10-17
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84344 91177308-0d34-0410-b5e6-96231b3b80d8
* Convert StringMap to using StringRef for its APIs.Daniel Dunbar2009-07-23
| | | | | | | | | | | | | - 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76888 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove attribution from file headers, per discussion on llvmdev.Chris Lattner2007-12-29
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45418 91177308-0d34-0410-b5e6-96231b3b80d8
* stringmap memory managed with malloc nowChris Lattner2007-04-04
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35666 91177308-0d34-0410-b5e6-96231b3b80d8
* use calloc instead of new/memset, it is more efficientChris Lattner2007-04-04
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35644 91177308-0d34-0410-b5e6-96231b3b80d8
* Extend StringMap to support being initialized as completely empty. WhenChris Lattner2007-04-04
| | | | | | | initialized this way, they do not do a malloc to allocate their buckets. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35642 91177308-0d34-0410-b5e6-96231b3b80d8
* greatly reduce hte default size of stringmap.Chris Lattner2007-04-03
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35632 91177308-0d34-0410-b5e6-96231b3b80d8
* Add support for removing elements out of StringMap.Chris Lattner2007-02-11
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34185 91177308-0d34-0410-b5e6-96231b3b80d8
* Replace the ugly FindValue method with STL-like find methods.Chris Lattner2007-02-11
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34183 91177308-0d34-0410-b5e6-96231b3b80d8
* remove support for stringmap visitors now that iterators exist.Chris Lattner2007-02-11
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34180 91177308-0d34-0410-b5e6-96231b3b80d8
* add support for iterators.Chris Lattner2007-02-11
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34179 91177308-0d34-0410-b5e6-96231b3b80d8
* Rename CStringMap -> StringMap, since it now supports nul characters in theChris Lattner2007-02-08
| | | | | | | strings. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34064 91177308-0d34-0410-b5e6-96231b3b80d8
* Allow cstringmap to contain strings with nul characters in them.Chris Lattner2007-02-08
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34062 91177308-0d34-0410-b5e6-96231b3b80d8
* wow, the link was already broken :)Chris Lattner2007-01-06
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32963 91177308-0d34-0410-b5e6-96231b3b80d8
* add a noteChris Lattner2007-01-06
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32962 91177308-0d34-0410-b5e6-96231b3b80d8
* add a highly efficient hash table that is specialized for mapping C stringsChris Lattner2006-10-29
to some other type. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31286 91177308-0d34-0410-b5e6-96231b3b80d8