[llvm] 8dc3fe0 - [NFC][MLGO] Use std::move when moving protobufs
Mircea Trofin via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 20 13:40:51 PDT 2021
Author: Mircea Trofin
Date: 2021-08-20T13:40:35-07:00
New Revision: 8dc3fe0cd1e1353e39be032a94bb163f7d4e0e14
URL: https://github.com/llvm/llvm-project/commit/8dc3fe0cd1e1353e39be032a94bb163f7d4e0e14
DIFF: https://github.com/llvm/llvm-project/commit/8dc3fe0cd1e1353e39be032a94bb163f7d4e0e14.diff
LOG: [NFC][MLGO] Use std::move when moving protobufs
Because of an odd linking problem, we need to temporarily support
building with TF C API 1.15 + tensorflow 2.50 pip package in
'development' mode scenarios. Protobuf Message 'Swap' is partially
implemented in the header (2.50) and relies on a symbol not found in TF
C API 1.15. std::move avoids that, at no semantic cost.
Added:
Modified:
llvm/lib/Analysis/TFUtils.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Analysis/TFUtils.cpp b/llvm/lib/Analysis/TFUtils.cpp
index dcc5e9712edd..3d10479c4544 100644
--- a/llvm/lib/Analysis/TFUtils.cpp
+++ b/llvm/lib/Analysis/TFUtils.cpp
@@ -292,11 +292,11 @@ class LoggerDataImpl {
void transferLog(tensorflow::SequenceExample &SE) {
auto *FL = SE.mutable_feature_lists()->mutable_feature_list();
if (IncludeReward)
- (*FL)[RewardSpec.name()].Swap(&Reward);
+ (*FL)[RewardSpec.name()] = std::move(Reward);
assert(FeatureLists.size() == LoggedFeatureSpecs.size());
for (size_t I = 0; I < FeatureLists.size(); ++I) {
const auto &LFS = LoggedFeatureSpecs[I];
- (*FL)[LFS.getLoggingName()].Swap(&FeatureLists[I]);
+ (*FL)[LFS.getLoggingName()] = std::move(FeatureLists[I]);
}
}
More information about the llvm-commits
mailing list