diff --git a/.pick_status.json b/.pick_status.json index fe831fed8ba..c76e6ed16c1 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -2114,7 +2114,7 @@ "description": "aco/lower_branches: Don't remove branches which jump over loops", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null, "notes": null diff --git a/src/amd/compiler/aco_lower_branches.cpp b/src/amd/compiler/aco_lower_branches.cpp index a9b73700384..41d69ad9fac 100644 --- a/src/amd/compiler/aco_lower_branches.cpp +++ b/src/amd/compiler/aco_lower_branches.cpp @@ -379,6 +379,10 @@ can_remove_branch(branch_ctx& ctx, Block& block, Pseudo_branch_instruction* bran if (uniform_branch && !ctx.program->blocks[i].instructions.empty()) return false; + /* Don't enter loops with empty exec mask. */ + if (ctx.program->blocks[i].loop_nest_depth > block.loop_nest_depth) + return false; + for (aco_ptr& instr : ctx.program->blocks[i].instructions) { if (instr->isSOPP()) { /* Discard early exits and loop breaks and continues should work fine with