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));