From aa35378aeb999bc72c5a48ebeebe2dc567226b1b Mon Sep 17 00:00:00 2001 From: Tony Wasserka Date: Tue, 3 Nov 2020 14:40:20 +0100 Subject: [PATCH] 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 Part-of: (cherry picked from commit 456beb40b8f74d37017eaeb6d0ad0a7108b08345) --- .pick_status.json | 2 +- src/amd/compiler/aco_register_allocation.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index b1de36c3fab..29142218806 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -4198,7 +4198,7 @@ "description": "aco/ra: Fix counting of subdword variables in get_reg_create_vector", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "master_sha": null, "because_sha": "52cc1f8237d9ed0042578777af4b28e5b33c6354" }, diff --git a/src/amd/compiler/aco_register_allocation.cpp b/src/amd/compiler/aco_register_allocation.cpp index 2e7935e2dee..736f5af84e5 100644 --- a/src/amd/compiler/aco_register_allocation.cpp +++ b/src/amd/compiler/aco_register_allocation.cpp @@ -1349,7 +1349,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;