diff --git a/llvm/lib/Analysis/DevelopmentModeInlineAdvisor.cpp b/llvm/lib/Analysis/DevelopmentModeInlineAdvisor.cpp index e7e8f2ac1ff25..790e00e1b3b06 100644 --- a/llvm/lib/Analysis/DevelopmentModeInlineAdvisor.cpp +++ b/llvm/lib/Analysis/DevelopmentModeInlineAdvisor.cpp @@ -27,8 +27,8 @@ #include "llvm/Support/CommandLine.h" #include "llvm/Support/ManagedStatic.h" -#include #include +#include using namespace llvm; @@ -260,9 +260,8 @@ static const std::vector TrainingOnlyFeatures{ static const std::vector getInputFeatures() { std::vector InputSpecs; - for (size_t I = 0; I < NumberOfFeatures; ++I) - InputSpecs.push_back( - TensorSpec(TFFeedPrefix + FeatureMap[I].name(), FeatureMap[I])); + for (const auto &Feature : FeatureMap) + InputSpecs.push_back(TensorSpec(TFFeedPrefix + Feature.name(), Feature)); append_range(InputSpecs, TrainingOnlyFeatures); return InputSpecs; } @@ -299,7 +298,8 @@ void TrainingLogger::logInlineEvent(const InlineEvent &Event, const MLModelRunner &ModelRunner) { L->startObservation(); size_t CurrentFeature = 0; - for (; CurrentFeature < NumberOfFeatures; ++CurrentFeature) + size_t FeatureMapSize = FeatureMap.size(); + for (; CurrentFeature < FeatureMapSize; ++CurrentFeature) L->logTensorValue(CurrentFeature, reinterpret_cast( ModelRunner.getTensorUntyped(CurrentFeature)));