aco/ra: Fix array access when finding register for subdword variables

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29235>
This commit is contained in:
Daniel Schürmann
2024-05-15 10:32:09 +02:00
committed by Marge Bot
parent 5326e033ff
commit 1b0edf3f33
+2 -1
View File
@@ -992,10 +992,11 @@ get_reg_simple(ra_ctx& ctx, const RegisterFile& reg_file, DefInfo info)
if (!bounds.contains({PhysReg{entry.first}, rc.size()}))
continue;
auto it = entry.second.begin();
for (unsigned i = 0; i < 4; i += info.stride) {
/* check if there's a block of free bytes large enough to hold the register */
bool reg_found =
std::all_of(&entry.second[i], &entry.second[std::min(4u, i + rc.bytes())],
std::all_of(std::next(it, i), std::next(it, std::min(4u, i + rc.bytes())),
[](unsigned v) { return v == 0; });
/* check if also the neighboring reg is free if needed */