[compiler-rt] fab0792 - [test][hwasan] Reserve vector in test

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 16 22:40:30 PDT 2023


Author: Vitaly Buka
Date: 2023-08-16T22:40:14-07:00
New Revision: fab079275aac895d5f48b96006f62390a5e24664

URL: https://github.com/llvm/llvm-project/commit/fab079275aac895d5f48b96006f62390a5e24664
DIFF: https://github.com/llvm/llvm-project/commit/fab079275aac895d5f48b96006f62390a5e24664.diff

LOG: [test][hwasan] Reserve vector in test

Added: 
    

Modified: 
    compiler-rt/test/hwasan/TestCases/Linux/create-thread-stress.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/test/hwasan/TestCases/Linux/create-thread-stress.cpp b/compiler-rt/test/hwasan/TestCases/Linux/create-thread-stress.cpp
index ac905a24117072..51e637851046b0 100644
--- a/compiler-rt/test/hwasan/TestCases/Linux/create-thread-stress.cpp
+++ b/compiler-rt/test/hwasan/TestCases/Linux/create-thread-stress.cpp
@@ -20,6 +20,7 @@ constexpr int kProcessIterations = 20;
 void Thread() {
   for (int i = 0; i < kChildIterations; ++i) {
     std::vector<std::thread> threads;
+    threads.reserve(kChildThreads);
     for (int i = 0; i < kChildThreads; ++i)
       threads.emplace_back([]() {});
     for (auto &t : threads)
@@ -29,6 +30,7 @@ void Thread() {
 
 void run() {
   std::vector<std::thread> threads;
+  threads.reserve(kTopThreads);
   for (int i = 0; i < kTopThreads; ++i)
     threads.emplace_back(Thread);
   for (auto &t : threads)


        


More information about the llvm-commits mailing list