[PATCH] D118771: [sanitizer_common] Fix DenseMapCustomTest.DefaultMinReservedSizeTest on SPARC
Rainer Orth via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 9 00:12:27 PST 2022
This revision was automatically updated to reflect the committed changes.
Closed by commit rG0d4b6f1f4b7b: [sanitizer_common] Fix DenseMapCustomTest.DefaultMinReservedSizeTest on SPARC (authored by ro).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D118771/new/
https://reviews.llvm.org/D118771
Files:
compiler-rt/lib/sanitizer_common/tests/sanitizer_dense_map_test.cpp
Index: compiler-rt/lib/sanitizer_common/tests/sanitizer_dense_map_test.cpp
===================================================================
--- compiler-rt/lib/sanitizer_common/tests/sanitizer_dense_map_test.cpp
+++ compiler-rt/lib/sanitizer_common/tests/sanitizer_dense_map_test.cpp
@@ -365,11 +365,10 @@
EXPECT_NE(M1, M3);
}
+const int ExpectedInitialBucketCount = GetPageSizeCached() / /* sizeof(KV) */ 8;
+
// Test for the default minimum size of a DenseMap
TEST(DenseMapCustomTest, DefaultMinReservedSizeTest) {
- // IF THIS VALUE CHANGE, please update InitialSizeTest, InitFromIterator, and
- // ReserveTest as well!
- const int ExpectedInitialBucketCount = 512;
// Formula from DenseMap::getMinBucketToReserveForEntries()
const int ExpectedMaxInitialEntries = ExpectedInitialBucketCount * 3 / 4 - 1;
@@ -410,9 +409,8 @@
// Test a few different size, 341 is *not* a random choice: we need a value
// that is 2/3 of a power of two to stress the grow() condition, and the power
// of two has to be at least 512 because of minimum size allocation in the
- // DenseMap (see DefaultMinReservedSizeTest). 513 is a value just above the
- // 512 default init.
- for (auto Size : {1, 2, 48, 66, 341, 513}) {
+ // DenseMap (see DefaultMinReservedSizeTest).
+ for (auto Size : {1, 2, 48, 66, 341, ExpectedInitialBucketCount + 1}) {
DenseMap<int, CountCopyAndMove> Map(Size);
unsigned MemorySize = Map.getMemorySize();
CountCopyAndMove::Copy = 0;
@@ -453,9 +451,8 @@
// Test a few different size, 341 is *not* a random choice: we need a value
// that is 2/3 of a power of two to stress the grow() condition, and the power
// of two has to be at least 512 because of minimum size allocation in the
- // DenseMap (see DefaultMinReservedSizeTest). 513 is a value just above the
- // 512 default init.
- for (auto Size : {1, 2, 48, 66, 341, 513}) {
+ // DenseMap (see DefaultMinReservedSizeTest).
+ for (auto Size : {1, 2, 48, 66, 341, ExpectedInitialBucketCount + 1}) {
DenseMap<int, CountCopyAndMove> Map;
Map.reserve(Size);
unsigned MemorySize = Map.getMemorySize();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D118771.407061.patch
Type: text/x-patch
Size: 2140 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220209/bbcdeec7/attachment.bin>
More information about the llvm-commits
mailing list