aco/lower_branches: Consider branch target of nested conditional branches

Totals from 1470 (1.74% of 84383) affected shaders: (Navi48)

Instrs: 5128451 -> 5126842 (-0.03%)
CodeSize: 29359832 -> 29353656 (-0.02%); split: -0.02%, +0.00%
Latency: 41047203 -> 41040786 (-0.02%)
InvThroughput: 6040459 -> 6039619 (-0.01%); split: -0.01%, +0.00%
Branches: 146219 -> 144648 (-1.07%)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39519>
This commit is contained in:
Daniel Schürmann 2026-01-23 12:36:33 +01:00 committed by Marge Bot
parent fbf2083b8f
commit 800a4957bb

View file

@ -392,8 +392,12 @@ can_remove_branch(branch_ctx& ctx, Block& block, Pseudo_branch_instruction* bran
ctx.program->blocks[i].kind & (block_kind_break | block_kind_continue);
bool discard_early_exit =
ctx.program->blocks[instr->salu().imm].kind & block_kind_discard_early_exit;
if (is_break_continue || discard_early_exit)
if (is_break_continue || discard_early_exit) {
/* If the branch target is the same, we can be sure that it will be taken. */
if (instr->salu().imm == target)
return true;
continue;
}
}
return false;
} else if (instr->isSALU()) {