aco: Consider p_cbranch_nz as divergent branch too.
authorTimur Kristóf <timur.kristof@gmail.com>
Sun, 2 Apr 2023 20:08:51 +0000 (22:08 +0200)
committerMarge Bot <emma+marge@anholt.net>
Mon, 3 Apr 2023 14:36:07 +0000 (14:36 +0000)
A p_cbranch_nz instruction that reads exec is divergent too.

Fixes: f030b75b7d2c359b90c18ee4ed83fa05265c12e0
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21493>

src/amd/compiler/aco_lower_to_hw_instr.cpp

index dc8dba5..439b043 100644 (file)
@@ -2629,7 +2629,8 @@ lower_to_hw_instr(Program* program)
          } else if (instr->isBranch()) {
             Pseudo_branch_instruction* branch = &instr->branch();
             const uint32_t target = branch->target[0];
-            const bool uniform_branch = !(branch->opcode == aco_opcode::p_cbranch_z &&
+            const bool uniform_branch = !((branch->opcode == aco_opcode::p_cbranch_z ||
+                                           branch->opcode == aco_opcode::p_cbranch_nz) &&
                                           branch->operands[0].physReg() == exec);
 
             /* Check if the branch instruction can be removed.