Module: Mesa
Branch: main
Commit: 9e5f311efec13a13f27641df3b153f3fcfad741c
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=9e5f311efec13a13f27641df3b153f3fcfad741c

Author: Georg Lehmann <[email protected]>
Date:   Mon Aug 15 13:26:23 2022 +0200

aco: Check that we don't override exec_val operands during branching sequence 
optimization.

Fixes: baab6f18c91 ("aco: Optimize branching sequence during SSA elimination.")
Signed-off-by: Georg Lehmann <[email protected]>
Reviewed-by: Timur Kristóf <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18049>

---

 src/amd/compiler/aco_ssa_elimination.cpp | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/amd/compiler/aco_ssa_elimination.cpp 
b/src/amd/compiler/aco_ssa_elimination.cpp
index ff74585cc67..f82058a6c44 100644
--- a/src/amd/compiler/aco_ssa_elimination.cpp
+++ b/src/amd/compiler/aco_ssa_elimination.cpp
@@ -417,6 +417,13 @@ try_optimize_branching_sequence(ssa_elimination_ctx& ctx, 
Block& block, const in
       }
    }
 
+   if (save_original_exec) {
+      /* We insert the exec copy before exec_val, so exec_val can't use those 
registers. */
+      for (const Operand& op : exec_val->operands)
+         if (regs_intersect(exec_copy_def, op))
+            return;
+   }
+
    /* Reassign the instruction to write exec directly. */
    exec_val->definitions[0] = Definition(exec, ctx.program->lane_mask);
 

Reply via email to