aco/ra: Fix off-by-one-error in print_regs

Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Fixes: 3675aefa84 ("aco/ra: Fix build with print_regs enabled")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10517>
(cherry picked from commit 5bfef2de66)
This commit is contained in:
Tony Wasserka 2021-04-29 18:06:53 +02:00 committed by Eric Engestrom
parent 23432781b0
commit b03dbc2d89
2 changed files with 3 additions and 4 deletions

View file

@ -922,7 +922,7 @@
"description": "aco/ra: Fix off-by-one-error in print_regs",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "3675aefa84e363d820a3e596b9f2795a0d51c39f"
},

View file

@ -355,8 +355,7 @@ private:
/* helper function for debugging */
UNUSED void print_regs(ra_ctx& ctx, bool vgprs, RegisterFile& reg_file)
{
unsigned max = vgprs ? ctx.program->max_reg_demand.vgpr : ctx.program->max_reg_demand.sgpr;
PhysRegInterval regs { vgprs ? PhysReg{256} : PhysReg{0}, max };
PhysRegInterval regs = get_reg_bounds(ctx.program, vgprs ? RegType::vgpr : RegType::sgpr);
char reg_char = vgprs ? 'v' : 's';
/* print markers */
@ -387,7 +386,7 @@ UNUSED void print_regs(ra_ctx& ctx, bool vgprs, RegisterFile& reg_file)
}
printf("\n");
printf("%u/%u used, %u/%u free\n", max - free_regs, max, free_regs, max);
printf("%u/%u used, %u/%u free\n", regs.size - free_regs, regs.size, free_regs, regs.size);
/* print assignments */
prev = 0;