diff --git a/src/amd/compiler/aco_ir.h b/src/amd/compiler/aco_ir.h index 28e84809b5a..e8cea9c4ffa 100644 --- a/src/amd/compiler/aco_ir.h +++ b/src/amd/compiler/aco_ir.h @@ -2219,6 +2219,8 @@ private: struct ra_test_policy { /* Force RA to always use its pessimistic fallback algorithm */ bool skip_optimistic_path = false; + /* Force get_reg() to always use its compact_relocate_vars() path */ + bool use_compact_relocate = false; }; void init(); diff --git a/src/amd/compiler/aco_register_allocation.cpp b/src/amd/compiler/aco_register_allocation.cpp index 991a802beaa..33b6c15acd8 100644 --- a/src/amd/compiler/aco_register_allocation.cpp +++ b/src/amd/compiler/aco_register_allocation.cpp @@ -1849,7 +1849,7 @@ get_reg(ra_ctx& ctx, const RegisterFile& reg_file, Temp temp, DefInfo info(ctx, instr, temp.regClass(), operand_index); - if (!ctx.policy.skip_optimistic_path) { + if (!ctx.policy.skip_optimistic_path && !ctx.policy.use_compact_relocate) { /* try to find space without live-range splits */ res = get_reg_simple(ctx, reg_file, info); @@ -1857,11 +1857,13 @@ get_reg(ra_ctx& ctx, const RegisterFile& reg_file, Temp temp, return *res; } - /* try to find space with live-range splits */ - res = get_reg_impl(ctx, reg_file, parallelcopies, info, instr); + if (!ctx.policy.use_compact_relocate) { + /* try to find space with live-range splits */ + res = get_reg_impl(ctx, reg_file, parallelcopies, info, instr); - if (res) - return *res; + if (res) + return *res; + } /* try compacting the linear vgprs to make more space */ std::vector pc;