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

Author: Daniel Schürmann <[email protected]>
Date:   Mon Sep 27 09:49:54 2021 +0100

aco/ra: don't copy linear VGPRs within CF in get_reg_create_vector()

Fixes: 6ed18749de52d1f24b23fad266eb3e8b46702752 ('aco: allow live-range splits 
of linear vgprs in top-level blocks')
Reviewed-by: Rhys Perry <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13058>

---

 src/amd/compiler/aco_register_allocation.cpp | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/src/amd/compiler/aco_register_allocation.cpp 
b/src/amd/compiler/aco_register_allocation.cpp
index d474dfe463a..e788aeb4410 100644
--- a/src/amd/compiler/aco_register_allocation.cpp
+++ b/src/amd/compiler/aco_register_allocation.cpp
@@ -1667,6 +1667,7 @@ get_reg_create_vector(ra_ctx& ctx, RegisterFile& 
reg_file, Temp temp,
 
       /* count variables to be moved and check "avoid" */
       bool avoid = false;
+      bool linear_vgpr = false;
       for (PhysReg j : reg_win) {
          if (reg_file[j] != 0) {
             if (reg_file[j] == 0xF0000000) {
@@ -1677,17 +1678,20 @@ get_reg_create_vector(ra_ctx& ctx, RegisterFile& 
reg_file, Temp temp,
                   k += reg_file.test(reg, 1);
             } else {
                k += 4;
-               /* we cannot split live ranges of linear vgprs inside control 
flow */
-               if (ctx.assignments[reg_file[j]].rc.is_linear_vgpr()) {
-                  if (ctx.block->kind & block_kind_top_level)
-                     avoid = true;
-                  else
-                     break;
-               }
+               linear_vgpr |= ctx.assignments[reg_file[j]].rc.is_linear_vgpr();
             }
          }
          avoid |= ctx.war_hint[j];
       }
+
+      if (linear_vgpr) {
+         /* we cannot split live ranges of linear vgprs inside control flow */
+         if (ctx.block->kind & block_kind_top_level)
+            avoid = true;
+         else
+            continue;
+      }
+
       if (avoid && !best_avoid)
          continue;
 

Reply via email to