Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions llvm/lib/Analysis/DevelopmentModeInlineAdvisor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/ManagedStatic.h"

#include <vector>
#include <optional>
#include <vector>

using namespace llvm;

Expand Down Expand Up @@ -260,9 +260,8 @@ static const std::vector<TensorSpec> TrainingOnlyFeatures{

static const std::vector<TensorSpec> getInputFeatures() {
std::vector<TensorSpec> InputSpecs;
Copy link
Preview

Copilot AI Jul 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Reserve the expected capacity for InputSpecs (e.g., InputSpecs.reserve(FeatureMap.size() + TrainingOnlyFeatures.size());) to avoid multiple reallocations during push_back.

Suggested change
std::vector<TensorSpec> InputSpecs;
std::vector<TensorSpec> InputSpecs;
InputSpecs.reserve(FeatureMap.size() + TrainingOnlyFeatures.size());

Copilot uses AI. Check for mistakes.

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;
}
Expand Down Expand Up @@ -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<const char *>(
ModelRunner.getTensorUntyped(CurrentFeature)));
Expand Down
Loading