From: Tony Wasserka Date: Wed, 24 Mar 2021 15:20:50 +0000 (+0100) Subject: aco/ra: Avoid unnecessary copying of std::vectors X-Git-Tag: upstream/21.2.3~5960 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=893aab57a85fde65dd0b09915455f278f19a71b8;p=platform%2Fupstream%2Fmesa.git aco/ra: Avoid unnecessary copying of std::vectors Reviewed-by: Rhys Perry Part-of: --- diff --git a/src/amd/compiler/aco_register_allocation.cpp b/src/amd/compiler/aco_register_allocation.cpp index ab1a674..2607f0d 100644 --- a/src/amd/compiler/aco_register_allocation.cpp +++ b/src/amd/compiler/aco_register_allocation.cpp @@ -2590,7 +2590,7 @@ void register_allocation(Program *program, std::vector& live_out_per_bloc /* finish incomplete phis and check if they became trivial */ for (Instruction* phi : ctx.incomplete_phis[succ_idx]) { - std::vector preds = phi->definitions[0].getTemp().is_linear() ? succ.linear_preds : succ.logical_preds; + const std::vector& preds = phi->definitions[0].getTemp().is_linear() ? succ.linear_preds : succ.logical_preds; for (unsigned i = 0; i < phi->operands.size(); i++) { phi->operands[i].setTemp(read_variable(ctx, phi->operands[i].getTemp(), preds[i])); phi->operands[i].setFixed(ctx.assignments[phi->operands[i].tempId()].reg); @@ -2601,7 +2601,7 @@ void register_allocation(Program *program, std::vector& live_out_per_bloc for (aco_ptr& instr : succ.instructions) { if (!is_phi(instr)) break; - std::vector preds = instr->opcode == aco_opcode::p_phi ? succ.logical_preds : succ.linear_preds; + const std::vector& preds = instr->opcode == aco_opcode::p_phi ? succ.logical_preds : succ.linear_preds; for (unsigned i = 0; i < instr->operands.size(); i++) { auto& operand = instr->operands[i];