[PATCH] D18345: Fix DenseMap::reserve(): the formula was wrong

Mehdi AMINI via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 22 02:01:14 PDT 2016


joker.eph created this revision.
joker.eph added a reviewer: dblaikie.
joker.eph added a subscriber: llvm-commits.

Just running the loop in the unittests for a few more iterations
(till 48) exhibit that the condition on the limit was not handled
properly in r263522.
Rewrite the test to use a class to count move/copies that happens
when inserting into the map.
Also take the opportunity to refactor the logic to compute the
number of buckets required for a given number of entries in the map.
Use this when constructing a DenseMap with a desired size given to
the constructor (and add a tests for this).

http://reviews.llvm.org/D18345

Files:
  include/llvm/ADT/DenseMap.h
  unittests/ADT/DenseMapTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D18345.51262.patch
Type: text/x-patch
Size: 4935 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160322/e05701d8/attachment.bin>


More information about the llvm-commits mailing list