[llvm] df0066a - [NFC][MLGO] Fix vector sizing
    Mircea Trofin via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Thu Jul 22 13:06:14 PDT 2021
    
    
  
Author: Mircea Trofin
Date: 2021-07-22T13:06:00-07:00
New Revision: df0066a1c9b9610c58d336bdf353e20a20b7ab3f
URL: https://github.com/llvm/llvm-project/commit/df0066a1c9b9610c58d336bdf353e20a20b7ab3f
DIFF: https://github.com/llvm/llvm-project/commit/df0066a1c9b9610c58d336bdf353e20a20b7ab3f.diff
LOG: [NFC][MLGO] Fix vector sizing
The bots only build release mode, and the use of `reserve` instead of
`resize`, while not causing invalid memory accesses, is incorrect.
Added: 
    
Modified: 
    llvm/lib/Analysis/ReleaseModeModelRunner.cpp
Removed: 
    
################################################################################
diff  --git a/llvm/lib/Analysis/ReleaseModeModelRunner.cpp b/llvm/lib/Analysis/ReleaseModeModelRunner.cpp
index 0b038b3e1c30..d2bf95388066 100644
--- a/llvm/lib/Analysis/ReleaseModeModelRunner.cpp
+++ b/llvm/lib/Analysis/ReleaseModeModelRunner.cpp
@@ -52,7 +52,7 @@ ReleaseModeModelRunner::ReleaseModeModelRunner(LLVMContext &Ctx)
       CompiledModel(std::make_unique<llvm::InlinerSizeModel>()) {
   assert(CompiledModel && "The CompiledModel should be valid");
 
-  FeatureIndices.reserve(NumberOfFeatures);
+  FeatureIndices.resize(NumberOfFeatures);
 
   for (size_t I = 0; I < NumberOfFeatures; ++I) {
     const int Index =
        
    
    
More information about the llvm-commits
mailing list