From 20448890ffbf6a6f54d0bdc2fafd5abe716ab19a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timur=20Krist=C3=B3f?= Date: Sun, 11 Jun 2023 16:01:17 +0200 Subject: [PATCH] aco: Mark exec write used when it writes other registers. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When an exec write isn't used but writes other registers besides exec, and also reads exec (such as s_and_saveexec), we would mistakenly delete the previous instruction that writes the exec value that this instruction uses. No Fossil DB changes on Rembrandt (GFX10.3). Fixes: 0211e66f65522caa1f6855b937ae4fc18af0c937 Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/9036 Signed-off-by: Timur Kristóf Reviewed-by: Georg Lehmann Part-of: (cherry picked from commit 67a0f2532fdbd7658560238aea5a3e4f6f2850a6) --- .pick_status.json | 2 +- src/amd/compiler/aco_ssa_elimination.cpp | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 087265dd6ec..d04a7d8c32b 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -2317,7 +2317,7 @@ "description": "aco: Mark exec write used when it writes other registers.", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "0211e66f65522caa1f6855b937ae4fc18af0c937" }, diff --git a/src/amd/compiler/aco_ssa_elimination.cpp b/src/amd/compiler/aco_ssa_elimination.cpp index 5bd545c7460..f9260026242 100644 --- a/src/amd/compiler/aco_ssa_elimination.cpp +++ b/src/amd/compiler/aco_ssa_elimination.cpp @@ -604,9 +604,10 @@ eliminate_useless_exec_writes_in_block(ssa_elimination_ctx& ctx, Block& block) bool writes_other = std::any_of(instr->definitions.begin(), instr->definitions.end(), [](const Definition& def) -> bool { return def.physReg() != exec && def.physReg() != scc; }); - if (!writes_other) + if (!writes_other) { instr.reset(); - continue; + continue; + } } /* For a newly encountered exec write, clear the used flag. */