From 876445faf1b0ef63ddb9d0111e35b74bd31b4a42 Mon Sep 17 00:00:00 2001 From: Vladislav Mikhalin Date: Sat, 14 Dec 2024 23:46:55 +0300 Subject: [PATCH] recompiler: emit a label right after s_branch to prevent dead code interferrence (#1785) --- src/shader_recompiler/frontend/control_flow_graph.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/shader_recompiler/frontend/control_flow_graph.cpp b/src/shader_recompiler/frontend/control_flow_graph.cpp index 8c3122b2..0816ec08 100644 --- a/src/shader_recompiler/frontend/control_flow_graph.cpp +++ b/src/shader_recompiler/frontend/control_flow_graph.cpp @@ -80,6 +80,8 @@ void CFG::EmitLabels() { if (inst.IsUnconditionalBranch()) { const u32 target = inst.BranchTarget(pc); AddLabel(target); + // Emit this label so that the block ends with s_branch instruction + AddLabel(pc + inst.length); } else if (inst.IsConditionalBranch()) { const u32 true_label = inst.BranchTarget(pc); const u32 false_label = pc + inst.length;