From 893aab57a85fde65dd0b09915455f278f19a71b8 Mon Sep 17 00:00:00 2001 From: Tony Wasserka Date: Wed, 24 Mar 2021 16:20:50 +0100 Subject: [PATCH] aco/ra: Avoid unnecessary copying of std::vectors Reviewed-by: Rhys Perry Part-of: --- src/amd/compiler/aco_register_allocation.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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]; -- 2.7.4