From dd16e21e97025857266edac6640c7a55f162413a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Sch=C3=BCrmann?= Date: Mon, 8 Feb 2021 14:38:43 +0100 Subject: [PATCH] aco: also consider VCC in get_reg_specified() This allows split_vector and others to keep their VCC position. Totals from 4573 (3.28% of 139391) affected shaders (Navi10): CodeSize: 54292268 -> 54289324 (-0.01%); split: -0.03%, +0.03% Instrs: 10327645 -> 10326941 (-0.01%); split: -0.04%, +0.04% Cycles: 744410748 -> 744034732 (-0.05%); split: -0.07%, +0.02% VMEM: 749093 -> 749092 (-0.00%); split: +0.00%, -0.00% SMEM: 269306 -> 269322 (+0.01%) SClause: 358746 -> 358744 (-0.00%) Copies: 826051 -> 823910 (-0.26%); split: -0.55%, +0.29% Branches: 355074 -> 356493 (+0.40%); split: -0.01%, +0.41% Reviewed-by: Rhys Perry Part-of: --- src/amd/compiler/aco_register_allocation.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/amd/compiler/aco_register_allocation.cpp b/src/amd/compiler/aco_register_allocation.cpp index 5b151d9429d..fa07606e16a 100644 --- a/src/amd/compiler/aco_register_allocation.cpp +++ b/src/amd/compiler/aco_register_allocation.cpp @@ -1227,7 +1227,10 @@ bool get_reg_specified(ra_ctx& ctx, PhysRegInterval reg_win = { reg, rc.size() }; PhysRegInterval bounds = get_reg_bounds(ctx.program, rc.type()); - if (!bounds.contains(reg_win)) + PhysRegInterval vcc_win = { vcc, 2 }; + /* VCC is outside the bounds */ + bool is_vcc = rc.type() == RegType::sgpr && vcc_win.contains(reg_win); + if (!bounds.contains(reg_win) && !is_vcc) return false; if (rc.is_subdword()) {