aco: test branch opcode if removing it in try_optimize_branching_sequence

We shouldn't remove a p_cbranch_nz branch in this situation.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Fixes: b731be2e96 ("aco: Remove branch instruction when exec is constant non-zero.")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18077>
This commit is contained in:
Rhys Perry 2022-08-15 17:14:11 +01:00 committed by Marge Bot
parent 21cb002b60
commit cfb306b4e4

View file

@ -502,7 +502,7 @@ try_optimize_branching_sequence(ssa_elimination_ctx& ctx, Block& block, const in
exec_val->operands[0].constantValue()) {
/* Remove the branch instruction when exec is constant non-zero. */
aco_ptr<Instruction>& branch = block.instructions.back();
if (branch->isBranch() && branch->operands.size() && branch->operands[0].physReg() == exec)
if (branch->opcode == aco_opcode::p_cbranch_z && branch->operands[0].physReg() == exec)
block.instructions.back().reset();
}