[PATCH] Prevent infinite growth of DenseMap/DenseSet

Chandler Carruth chandlerc at google.com
Wed Oct 30 02:09:22 PDT 2013


Thanks for tracking this down. LGTM with a style nit below.

On Tue, Oct 29, 2013 at 12:59 PM, Howard Hinnant <hhinnant at apple.com> wrote:

> Index: include/llvm/ADT/DenseMap.h
> ===================================================================
> --- include/llvm/ADT/DenseMap.h (revision 193642)
> +++ include/llvm/ADT/DenseMap.h (working copy)
> @@ -439,8 +439,8 @@
>        LookupBucketFor(Key, TheBucket);
>        NumBuckets = getNumBuckets();
>      }
> -    if (NumBuckets-(NewNumEntries+getNumTombstones()) <= NumBuckets/8) {
> -      this->grow(NumBuckets * 2);
> +    else if (NumBuckets-(NewNumEntries+getNumTombstones()) <=
> NumBuckets/8) {
>

Pull the else onto the same line as the }?


> +      this->grow(NumBuckets);
>        LookupBucketFor(Key, TheBucket);
>      }
>      assert(TheBucket);
>
> Howard
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20131030/ace28af2/attachment.html>


More information about the llvm-commits mailing list