summaryrefslogtreecommitdiff
path: root/lib/Support/SmallPtrSet.cpp
Commit message (Collapse)AuthorAge
* Fixing a possible memory leak from a failing realloc() call.Aaron Ballman2013-11-18
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195018 91177308-0d34-0410-b5e6-96231b3b80d8
* SmallVector and SmallPtrSet allocations now power-of-two aligned.Jean-Luc Duprat2013-03-29
| | | | | | | | This time tested on both OSX and Linux. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178377 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "Fix allocations of SmallVector and SmallPtrSet so they are more ↵Rafael Espindola2013-03-29
| | | | | | | | | | | | | | | | | prone to" This reverts commit 617330909f0c26a3f2ab8601a029b9bdca48aa61. It broke the bots: /home/clangbuild2/clang-ppc64-2/llvm.src/unittests/ADT/SmallVectorTest.cpp:150: PushPopTest /home/clangbuild2/clang-ppc64-2/llvm.src/unittests/ADT/SmallVectorTest.cpp:118: Failure Value of: v[i].getValue() Actual: 0 Expected: value Which is: 2 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178334 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix allocations of SmallVector and SmallPtrSet so they are more prone toJean-Luc Duprat2013-03-29
| | | | | | | | being power-of-two sized. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178332 91177308-0d34-0410-b5e6-96231b3b80d8
* SmallPtrSet: Reuse DenseMapInfo's pointer hash function instead of inventing ↵Benjamin Kramer2012-04-18
| | | | | | | | | | a bad one ourselves. DenseMap's hash function uses slightly more entropy and reduces hash collisions significantly. I also experimented with Hashing.h, but it didn't gave a lot of improvement while being much more expensive to compute. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@154996 91177308-0d34-0410-b5e6-96231b3b80d8
* Copy the right amount of elements.Benjamin Kramer2012-03-07
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152254 91177308-0d34-0410-b5e6-96231b3b80d8
* SmallPtrSet: Copy all the elements when swapping, not just numelements.Benjamin Kramer2012-03-07
| | | | | | | This fixes a build failure in webkit. Copying all elements shouldn't be necessary, I'll look out for a better fix soon. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152252 91177308-0d34-0410-b5e6-96231b3b80d8
* SmallPtrSet: Provide a more efficient implementation of swap than the ↵Benjamin Kramer2012-03-06
| | | | | | | | | default triple-copy std::swap. This currently assumes that both sets have the same SmallSize to keep the implementation simple, a limitation that can be lifted if someone cares. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152143 91177308-0d34-0410-b5e6-96231b3b80d8
* Prevent infinite growth of SmallPtrSet 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@128566 91177308-0d34-0410-b5e6-96231b3b80d8
* Rather than giving SmallPtrSetImpl a member field SmallArray which is magicallyDuncan Sands2010-06-30
| | | | | | | | | | | | | | | | | replaced by a bigger array in SmallPtrSet (by overridding it), instead just use a pointer to the start of the storage, and have SmallPtrSet pass in the value to use. This has the disadvantage that SmallPtrSet becomes bigger by one pointer. It has the advantage that it no longer uses tricky C++ rules, and is clearly correct while I'm not sure the previous version was. This was inspired by g++-4.6 pointing out that SmallPtrSetImpl was writing off the end of SmallArray, which it was. Since SmallArray is replaced with a bigger array in SmallPtrSet, the write was still to valid memory. But it was writing off the end of the declared array type - sounds kind of dubious to me, like it sounded dubious to g++-4.6. Maybe g++-4.6 is wrong and this construct is perfectly valid and correctly compiled by all compilers, but I think it is better to avoid the whole can of worms by avoiding this construct. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107285 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix several const-correctness issues, resolving some -Wcast-qual warnings.Dan Gohman2008-08-05
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54349 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
* make smallptrset more const and type correct, which caught a fewChris Lattner2007-11-06
| | | | | | | minor bugs. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43782 91177308-0d34-0410-b5e6-96231b3b80d8
* Properly use const qualifiersAnton Korobeynikov2007-08-15
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41111 91177308-0d34-0410-b5e6-96231b3b80d8
* When clearing a SmallPtrSet, if the set had a huge capacity, but theChris Lattner2007-08-05
| | | | | | | | | | | contents of the set were small, deallocate and shrink the set. This avoids having us to memset as much data, significantly speeding up some pathological cases. For example, this speeds up the verifier from 0.3899s to 0.0763 (5.1x) on the testcase from PR1432 in a release build. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40837 91177308-0d34-0410-b5e6-96231b3b80d8
* Allow SmallPtrSet to hold pointers to const data.Owen Anderson2007-07-27
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40556 91177308-0d34-0410-b5e6-96231b3b80d8
* Make the copy constructor of SmallPtrSet much faster.Owen Anderson2007-07-24
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40474 91177308-0d34-0410-b5e6-96231b3b80d8
* Remember to free the heap allocated array if we're not going to use it.Owen Anderson2007-07-19
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40043 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix an issue where assignments that caused a SmallPtrSet to become non-smallOwen Anderson2007-07-18
| | | | | | | | would result in calling realloc() on a null pointer. Instead, if we encounter this situation, make a normal call to malloc(). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40014 91177308-0d34-0410-b5e6-96231b3b80d8
* Unbreak the build by putting calls to free into the implementation file andReid Spencer2007-07-17
| | | | | | | having that implementation file #include <cstdlib>. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@39952 91177308-0d34-0410-b5e6-96231b3b80d8
* Use realloc() to (potentially) resize the contents of SmallPtrSet in place.Owen Anderson2007-07-16
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@39926 91177308-0d34-0410-b5e6-96231b3b80d8
* Make the assignment operator for SmallPtrSet much faster for normal cases.Owen Anderson2007-07-09
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@38474 91177308-0d34-0410-b5e6-96231b3b80d8
* Make the assignment operator for SmallPtrSet return a reference, and fix a ↵Owen Anderson2007-07-09
| | | | | | | | | | | long-standing bug in the copy ctor while I'm at it. Thanks to Chris Lattner for help with this patch. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@38470 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix an error in the assignment operator that was causing an infinite loop in ↵Owen Anderson2007-07-09
| | | | | | | | | GVNPRE.cpp. Patch by Chis Lattner. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@38467 91177308-0d34-0410-b5e6-96231b3b80d8
* implement operator= for smallptrsetChris Lattner2007-07-09
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@38460 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a bug in SmallPtrSet that was causing GVNPRE to enter an infinite loop.Owen Anderson2007-06-22
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37697 91177308-0d34-0410-b5e6-96231b3b80d8
* Two changes:Chris Lattner2007-06-21
| | | | | | | | | | 1. Make SmallPtrSet::erase faster in the small case by replacing a memmove with a pointer copy. 2. Fix a bug where the null terminator at the end of the array in the small case was not copied git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37696 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix PR1329.Jeff Cohen2007-04-14
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36016 91177308-0d34-0410-b5e6-96231b3b80d8
* do not let the table fill up with tombstones.Chris Lattner2007-02-07
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33973 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a bug in smallptrset::erase: in the small case, return true if theChris Lattner2007-02-05
| | | | | | | element was in the set. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33931 91177308-0d34-0410-b5e6-96231b3b80d8
* implement SmallPtrSet::eraseChris Lattner2007-01-27
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33581 91177308-0d34-0410-b5e6-96231b3b80d8
* add a noteChris Lattner2007-01-27
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33578 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a new SmallSet ADT specialized for pointers.Chris Lattner2007-01-27
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33577 91177308-0d34-0410-b5e6-96231b3b80d8