From 67c1f32228de25dff56ec9c625af3001932e1d4b Mon Sep 17 00:00:00 2001 From: Tony Wasserka Date: Mon, 30 Nov 2020 12:40:02 +0100 Subject: [PATCH] aco/ra: Update register use bounds before recursing in get_regs_for_copies MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Delaying the call to adjust_max_used_regs until after get_regs_for_copies returns puts the RA context into a state where registers past max_used_gpr may be blocked. This isn't an issue on its own, but it adds a surprising corner case to get_reg_simple that is easily avoided now. Reviewed-by: Daniel Schürmann Part-of: --- src/amd/compiler/aco_register_allocation.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/amd/compiler/aco_register_allocation.cpp b/src/amd/compiler/aco_register_allocation.cpp index 2557559b5c0..247219ee1c0 100644 --- a/src/amd/compiler/aco_register_allocation.cpp +++ b/src/amd/compiler/aco_register_allocation.cpp @@ -945,12 +945,11 @@ bool get_regs_for_copies(ra_ctx& ctx, /* mark the area as blocked */ reg_file.block(PhysReg{reg_lo}, var.rc); + adjust_max_used_regs(ctx, var.rc, reg_lo); if (!get_regs_for_copies(ctx, reg_file, parallelcopies, new_vars, lb, ub, instr, def_reg_lo, def_reg_hi)) return false; - adjust_max_used_regs(ctx, var.rc, reg_lo); - /* create parallelcopy pair (without definition id) */ Temp tmp = Temp(id, var.rc); Operand pc_op = Operand(tmp);