From: Daniel Schürmann Date: Mon, 7 Oct 2019 00:52:55 +0000 (+0200) Subject: aco: don't reorder instructions in order to lower boolean phis X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f584c427077bfacea9feef5846c92896e7101449;p=mesa.git aco: don't reorder instructions in order to lower boolean phis Reviewed-by: Rhys Perry --- diff --git a/src/amd/compiler/aco_lower_bool_phis.cpp b/src/amd/compiler/aco_lower_bool_phis.cpp index 7a4940ab1c8..ac4663a2ce1 100644 --- a/src/amd/compiler/aco_lower_bool_phis.cpp +++ b/src/amd/compiler/aco_lower_bool_phis.cpp @@ -216,36 +216,18 @@ void lower_linear_bool_phi(Program *program, Block *block, aco_ptr& void lower_bool_phis(Program* program) { for (Block& block : program->blocks) { - std::vector> instructions; - std::vector> non_phi; - instructions.swap(block.instructions); - block.instructions.reserve(instructions.size()); - unsigned i = 0; - for (; i < instructions.size(); i++) - { - aco_ptr& phi = instructions[i]; - if (phi->opcode != aco_opcode::p_phi && phi->opcode != aco_opcode::p_linear_phi) - break; - if (phi->opcode == aco_opcode::p_phi && phi->definitions[0].regClass() == s2) { - lower_divergent_bool_phi(program, &block, phi); - block.instructions.emplace_back(std::move(phi)); - } else if (phi->opcode == aco_opcode::p_linear_phi && phi->definitions[0].regClass() == s1) { + for (aco_ptr& phi : block.instructions) { + if (phi->opcode == aco_opcode::p_phi) { + if (phi->definitions[0].regClass() == s2) + lower_divergent_bool_phi(program, &block, phi); + } else if (phi->opcode == aco_opcode::p_linear_phi) { /* if it's a valid non-boolean phi, this should be a no-op */ - lower_linear_bool_phi(program, &block, phi); - block.instructions.emplace_back(std::move(phi)); + if (phi->definitions[0].regClass() == s1) + lower_linear_bool_phi(program, &block, phi); } else { - block.instructions.emplace_back(std::move(phi)); + break; } } - for (auto&& instr : non_phi) { - assert(instr->opcode != aco_opcode::p_phi && instr->opcode != aco_opcode::p_linear_phi); - block.instructions.emplace_back(std::move(instr)); - } - for (; i < instructions.size(); i++) { - aco_ptr instr = std::move(instructions[i]); - assert(instr->opcode != aco_opcode::p_phi && instr->opcode != aco_opcode::p_linear_phi); - block.instructions.emplace_back(std::move(instr)); - } } }