Skip to content

Commit

Permalink
[Cleanup] Use push_back instead of emplace_back where appropriate (go…
Browse files Browse the repository at this point in the history
…/totw/112)

PiperOrigin-RevId: 706713654
  • Loading branch information
frgossen authored and Google-ML-Automation committed Dec 19, 2024
1 parent ca3ddd2 commit 9957144
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions xla/hlo/builder/lib/comparators.cc
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ XlaComputation CreateScalarComparisonComputation(
absl::StrCat("p.", parameter_count, ".lhs"));
auto rhs_param = Parameter(b.get(), parameter_count * 2 + 1, scalar_shape,
absl::StrCat("p.", parameter_count, ".rhs"));
lhs_params.emplace_back(lhs_param);
rhs_params.emplace_back(rhs_param);
lhs_params.push_back(lhs_param);
rhs_params.push_back(rhs_param);
if (generators[parameter_count].has_value()) {
last_generator_index = parameter_count;
}
Expand Down
2 changes: 1 addition & 1 deletion xla/hlo/builder/xla_builder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3456,7 +3456,7 @@ XlaOp XlaBuilder::ConditionalImpl(

std::vector<XlaOp> operands(1, branch_index);
for (const XlaOp branch_operand : branch_operands) {
operands.emplace_back(branch_operand);
operands.push_back(branch_operand);
}
return AddInstruction(std::move(instr), HloOpcode::kConditional,
absl::MakeSpan(operands));
Expand Down
2 changes: 1 addition & 1 deletion xla/hlo/ir/hlo_computation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1728,7 +1728,7 @@ std::unique_ptr<HloComputation> HloComputation::CloneInContext(
for (HloInstruction* operand : cur->operands()) {
const HloInstruction* new_operand = replace(operand);
if (new_operand) {
dfs_stack.emplace_back(new_operand);
dfs_stack.push_back(new_operand);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion xla/hlo/parser/hlo_parser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6629,7 +6629,7 @@ bool HloParserImpl::ParseListShardingType(
if (!ParseOpShardingType(&type)) {
return false;
}
types->emplace_back(type);
types->push_back(type);
} while (EatIfPresent(TokKind::kComma));
}

Expand Down
6 changes: 3 additions & 3 deletions xla/hlo/transforms/collectives/collective_quantizer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ std::vector<HloInstruction*> FindDequantizationSubgraphRecursive(
return {};
}

subgraph.emplace_back(instr);
subgraph.push_back(instr);
if (Match(instr, ConvertToWiderType())) {
return subgraph;
}
Expand Down Expand Up @@ -231,15 +231,15 @@ std::optional<ConversionSubgraph> IsSupportedQuantization(
BitcastPreservesElementType(), m::Copy(), m::Reshape(),
m::Slice(), m::Multiply(), m::Divide(), m::Clamp()))) {
if (instr->user_count() > 0) {
ops.emplace_back(instr);
ops.push_back(instr);
instr = instr->users()[0];
continue;
}
break;
}

if (Match(instr, ConvertToNarrowerType())) {
ops.emplace_back(instr);
ops.push_back(instr);
break;
}
VLOG(5) << "Unsupported instruction.";
Expand Down
4 changes: 2 additions & 2 deletions xla/hlo/transforms/host_offloader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -855,7 +855,7 @@ absl::StatusOr<bool> UpdateMemorySpaceForHostOffloadedOutputs(
// If instruction is MoveToHost, we will replace usage.
if (instr_and_shape.instruction->IsCustomCall(
host_memory_offload_annotations::kMoveToHostCustomCallTarget)) {
to_replace.emplace_back(instr_and_shape);
to_replace.push_back(instr_and_shape);
continue;
}

Expand Down Expand Up @@ -1014,7 +1014,7 @@ absl::StatusOr<bool> HostOffloader::HandleRedundantCopiesBackToHost(

queue.push(successor);
host_instrs_tree.mutable_element(output_shape_index)
->emplace_back(successor);
->push_back(successor);
}
}

Expand Down
2 changes: 1 addition & 1 deletion xla/hlo/transforms/simplifiers/float_normalization.cc
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ absl::Status FloatNormalizationVisitor::ChangeOutputTypeThenInsertConvertBack(
if (allow_excess_precision && user->opcode() == HloOpcode::kConvert &&
user->shape().element_type() == to && to == HighPrecisionType() &&
from == LowPrecisionType()) {
conversions_to_simplify.emplace_back(user);
conversions_to_simplify.push_back(user);
} else {
TF_RETURN_IF_ERROR(hlo->ReplaceUseWithDifferentShape(user, new_hlo));
}
Expand Down

0 comments on commit 9957144

Please sign in to comment.