Mesa (master): aco/ra: Fix counting of subdword variables in get_reg_create_vector

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Nov 4 12:21:05 UTC 2020


Module: Mesa
Branch: master
Commit: 456beb40b8f74d37017eaeb6d0ad0a7108b08345
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=456beb40b8f74d37017eaeb6d0ad0a7108b08345

Author: Tony Wasserka <tony.wasserka at gmx.de>
Date:   Tue Nov  3 14:40:20 2020 +0100

aco/ra: Fix counting of subdword variables in get_reg_create_vector

The loop variable "k" shadowed another variable in the outer scope, so
this loop had no actual effect.

Fixes: 52cc1f8237d ("aco: improve p_create_vector RA for sub-dword operands")
Reviewed-by: Rhys Perry <pendingchaos02 at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7427>

---

 src/amd/compiler/aco_register_allocation.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/amd/compiler/aco_register_allocation.cpp b/src/amd/compiler/aco_register_allocation.cpp
index 693309781be..39c7842c4e9 100644
--- a/src/amd/compiler/aco_register_allocation.cpp
+++ b/src/amd/compiler/aco_register_allocation.cpp
@@ -1350,7 +1350,7 @@ PhysReg get_reg_create_vector(ra_ctx& ctx,
                PhysReg reg;
                reg.reg_b = j * 4;
                unsigned bytes_left = bytes - (j - reg_lo) * 4;
-               for (unsigned k = 0; k < MIN2(bytes_left, 4); k++, reg.reg_b++)
+               for (unsigned byte_idx = 0; byte_idx < MIN2(bytes_left, 4); byte_idx++, reg.reg_b++)
                   k += reg_file.test(reg, 1);
             } else {
                k += 4;



More information about the mesa-commit mailing list