[llvm] 5bb9465 - [llvm-exegesis] Reserve members in array

Aiden Grossman via llvm-commits llvm-commits at lists.llvm.org
Sat Nov 16 18:32:14 PST 2024


Author: Aiden Grossman
Date: 2024-11-17T02:32:04Z
New Revision: 5bb9465d35914e9833c4fe9278a855a4cd75c7af

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

LOG: [llvm-exegesis] Reserve members in array

This patch reserves members in the RegisterSetUp vector as we statically
know the size.

Added: 
    

Modified: 
    llvm/tools/llvm-exegesis/lib/Assembler.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/tools/llvm-exegesis/lib/Assembler.cpp b/llvm/tools/llvm-exegesis/lib/Assembler.cpp
index 6f6ef16153b328..13c8c2048a5c03 100644
--- a/llvm/tools/llvm-exegesis/lib/Assembler.cpp
+++ b/llvm/tools/llvm-exegesis/lib/Assembler.cpp
@@ -272,6 +272,7 @@ Error assembleToStream(const ExegesisTarget &ET,
   }
 
   std::vector<unsigned> RegistersSetUp;
+  RegistersSetUp.reserve(Key.RegisterInitialValues.size());
   for (const auto &InitValue : Key.RegisterInitialValues) {
     RegistersSetUp.push_back(InitValue.Register);
   }


        


More information about the llvm-commits mailing list