From ccf4bcd162cae2b5df9b47caf00f198beaf2c4a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Sch=C3=BCrmann?= Date: Thu, 3 Mar 2022 00:52:06 +0100 Subject: [PATCH] aco/ra: don't immediately assign a register for p_branch These get now assigned after handling phis. Totals from 564 (0.42% of 134913) affected shaders: (GFX10.3) CodeSize: 5519744 -> 5515308 (-0.08%) Instrs: 1063045 -> 1061936 (-0.10%) Latency: 11880452 -> 11875904 (-0.04%) InvThroughput: 2259933 -> 2259581 (-0.02%); split: -0.02%, +0.00% Copies: 86908 -> 85799 (-1.28%) Reviewed-by: Rhys Perry Part-of: --- src/amd/compiler/aco_register_allocation.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/amd/compiler/aco_register_allocation.cpp b/src/amd/compiler/aco_register_allocation.cpp index 7b8027eb5fe..82af2951ade 100644 --- a/src/amd/compiler/aco_register_allocation.cpp +++ b/src/amd/compiler/aco_register_allocation.cpp @@ -2577,6 +2577,13 @@ register_allocation(Program* program, std::vector& live_out_per_block, ra continue; } + /* unconditional branches are handled after phis of the target */ + if (instr->opcode == aco_opcode::p_branch) { + /* last instruction of the block */ + instructions.emplace_back(std::move(instr)); + break; + } + std::vector> parallelcopy; assert(!is_phi(instr));