From 43aeeb8b88a3e9989357bbd9c43268f5891f6f97 Mon Sep 17 00:00:00 2001 From: Rhys Perry Date: Tue, 28 Apr 2026 11:48:46 +0100 Subject: [PATCH] aco/ra: test the register file in get_reg_specified() when necessary MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rhys Perry Backport-to: * Reviewed-by: Daniel Schürmann Part-of: --- src/amd/compiler/aco_register_allocation.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/amd/compiler/aco_register_allocation.cpp b/src/amd/compiler/aco_register_allocation.cpp index 003c1e317cf..b8c4f4c5850 100644 --- a/src/amd/compiler/aco_register_allocation.cpp +++ b/src/amd/compiler/aco_register_allocation.cpp @@ -1633,6 +1633,12 @@ get_reg_specified(ra_ctx& ctx, const RegisterFile& reg_file, RegClass rc, if (reg.reg_b % info.data_stride) return false; + /* In other cases, we assume the caller ensured that this is fine. */ + if (info.rc.bytes() > rc.bytes()) { + if (reg_file.test(reg, info.rc.bytes())) + return false; + } + assert(util_is_power_of_two_nonzero(info.stride)); reg.reg_b &= ~(info.stride - 1);