Skip to content

Commit 8e58e1c

Browse files
apivovarovGoogle-ML-Automation
authored andcommitted
PR #23056: Remove std::move for trivially copyable types
Imported from GitHub PR #23056 Changes: - Removed unnecessary std::move calls for some trivially_copyable classes - Literal::CopyFrom expects a reference (&), not an r-value reference (&&). Removed std::move on the first parameter. Copybara import of the project: -- 6051f15 by Alexander Pivovarov <[email protected]>: Remove std::move for trivially copyable types Merging this change closes #23056 COPYBARA_INTEGRATE_REVIEW=#23056 from apivovarov:no_move_for_KernelMetadata 6051f15 PiperOrigin-RevId: 739114605
1 parent 8eb6944 commit 8e58e1c

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

xla/hlo/evaluator/hlo_evaluator.cc

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -318,11 +318,11 @@ std::optional<ParamIndexAndValue> TryParsingInstructionAsParameterAndInteger(
318318
}
319319
std::optional<DynamicOrStaticInteger> integer_value =
320320
GetInstructionValueAsInteger(instruction, precomputed_analyses);
321-
result.value = std::move(integer_value);
321+
result.value = integer_value;
322322
if (!result.IsValid()) {
323323
return std::nullopt;
324324
}
325-
return std::optional<ParamIndexAndValue>(std::move(result));
325+
return result;
326326
}
327327

328328
// Represents the while loop condition comparison.
@@ -377,8 +377,7 @@ std::optional<WhileCondComparisonOrNoOp> PatternMatchLoopCondComparison(
377377
if (!lhs.has_value() || !rhs.has_value()) {
378378
return std::nullopt;
379379
}
380-
return WhileCondComparison{comparison->comparison_direction(),
381-
*std::move(lhs), *std::move(rhs)};
380+
return WhileCondComparison{comparison->comparison_direction(), *lhs, *rhs};
382381
}
383382
// Finds the while loop condition comparison by matching the loop condition root
384383
// with known patterns.
@@ -1707,7 +1706,7 @@ absl::Status HloEvaluator::HandleTuple(const HloInstruction* tuple) {
17071706
CHECK(new_result.IsDetermined(visitor_shape_index_));
17081707
Literal literal;
17091708
TF_RETURN_IF_ERROR(
1710-
literal.CopyFrom(std::move(new_result),
1709+
literal.CopyFrom(new_result,
17111710
/*dest_shape_index=*/visitor_shape_index_,
17121711
/*src_shape_index=*/visitor_shape_index_));
17131712
SetEvaluatedLiteralFor(tuple, std::move(literal));

xla/stream_executor/kernel.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,9 +220,7 @@ class Kernel {
220220
ThreadDim threads, size_t dynamic_shared_memory_bytes) const = 0;
221221

222222
const KernelMetadata &metadata() const { return metadata_; }
223-
void set_metadata(KernelMetadata metadata) {
224-
metadata_ = std::move(metadata);
225-
}
223+
void set_metadata(KernelMetadata metadata) { metadata_ = metadata; }
226224

227225
const KernelArgsPacking &args_packing() const { return args_packing_; }
228226
void set_args_packing(KernelArgsPacking args_packing) {

0 commit comments

Comments
 (0)