aco/ra: don't immediately assign a register for p_branch
authorDaniel Schürmann <daniel@schuermann.dev>
Wed, 2 Mar 2022 23:52:06 +0000 (00:52 +0100)
committerMarge Bot <emma+marge@anholt.net>
Thu, 3 Mar 2022 20:21:08 +0000 (20:21 +0000)
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 <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13432>

src/amd/compiler/aco_register_allocation.cpp

index 7b8027e..82af295 100644 (file)
@@ -2577,6 +2577,13 @@ register_allocation(Program* program, std::vector<IDSet>& 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<std::pair<Operand, Definition>> parallelcopy;
 
          assert(!is_phi(instr));