From b406cfd92227b039e7ab3a257d36a74bb2b75451 Mon Sep 17 00:00:00 2001 From: Gert Wollny Date: Fri, 10 Feb 2023 15:57:13 +0100 Subject: [PATCH] r600/sfn: Don't copy propagate indirect loads to more than one dest Propagating the indirect load to more instructions would result in more address load instructions. This would (a) remove the advantage of eliminating one move, and (b) introduce more latency, because between address load and use two cycles must pass. Signed-off-by: Gert Wollny Part-of: --- src/gallium/drivers/r600/sfn/sfn_optimizer.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/gallium/drivers/r600/sfn/sfn_optimizer.cpp b/src/gallium/drivers/r600/sfn/sfn_optimizer.cpp index db0dde7a206..cb90b402ccd 100644 --- a/src/gallium/drivers/r600/sfn/sfn_optimizer.cpp +++ b/src/gallium/drivers/r600/sfn/sfn_optimizer.cpp @@ -360,6 +360,16 @@ CopyPropFwdVisitor::visit(AluInstr *instr) auto src = instr->psrc(0); auto dest = instr->dest(); + /* Don't propagate an indirect load to more than one + * instruction, because we may have to split the address loads + * creating more instructions */ + if (dest->uses().size() > 1) { + auto [addr, is_for_dest, index] = instr->indirect_addr(); + if (addr && !is_for_dest) + return; + } + + auto ii = dest->uses().begin(); auto ie = dest->uses().end();