From 46047cf5ca59ea612f7be54f6c206cc9948aba3b Mon Sep 17 00:00:00 2001 From: Rhys Perry Date: Thu, 9 Apr 2026 13:56:16 +0100 Subject: [PATCH] aco/ra: fix fill() with certain subdword cases MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If div_ceil(start.byte() + num_bytes, 4) != div_ceil(num_bytes, 4), like v3b at byte=2. Also, the non-const operator[] was unused and unsafe. Signed-off-by: Rhys Perry Reviewed-by: Daniel Schürmann Part-of: --- src/amd/compiler/aco_register_allocation.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/amd/compiler/aco_register_allocation.cpp b/src/amd/compiler/aco_register_allocation.cpp index e99b53fd560..7cf7e0c5c4d 100644 --- a/src/amd/compiler/aco_register_allocation.cpp +++ b/src/amd/compiler/aco_register_allocation.cpp @@ -329,8 +329,6 @@ public: const uint32_t& operator[](PhysReg index) const { return regs[index]; } - uint32_t& operator[](PhysReg index) { return regs[index]; } - unsigned count_zero(PhysRegInterval reg_interval) const { unsigned res = 0; @@ -457,8 +455,9 @@ private: void fill_subdword(PhysReg start, unsigned num_bytes, uint32_t val) { - fill(start, DIV_ROUND_UP(num_bytes, 4), 0xF0000000); for (PhysReg i = start; i.reg_b < start.reg_b + num_bytes; i = PhysReg(i + 1)) { + regs[i] = 0xF0000000; + /* emplace or get */ std::array& sub = subdword_regs.emplace(i, std::array{0, 0, 0, 0}).first->second;