aco: skip NIR in unreachable merge blocks

NIR removes most of this but undef instructions for loop header phis can
remain. These were harmless because ACO would DCE them itself.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
CC: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3658>
(cherry picked from commit 46e94fd854)
This commit is contained in:
Rhys Perry 2020-01-31 16:47:10 +00:00 committed by Eric Engestrom
parent 275e939299
commit a1fd16e507
2 changed files with 7 additions and 3 deletions

View file

@ -481,7 +481,7 @@
"description": "aco: skip NIR in unreachable merge blocks",
"nominated": true,
"nomination_type": 0,
"resolution": 0,
"resolution": 1,
"master_sha": null,
"because_sha": null
},

View file

@ -8180,7 +8180,7 @@ static void end_divergent_if(isel_context *ctx, if_context *ic)
}
}
static void visit_if(isel_context *ctx, nir_if *if_stmt)
static bool visit_if(isel_context *ctx, nir_if *if_stmt)
{
Temp cond = get_ssa_temp(ctx, if_stmt->condition.ssa);
Builder bld(ctx->program, ctx->block);
@ -8273,6 +8273,7 @@ static void visit_if(isel_context *ctx, nir_if *if_stmt)
ctx->block = ctx->program->insert_block(std::move(BB_endif));
append_logical_start(ctx->block);
}
return !ctx->cf_info.has_branch;
} else { /* non-uniform condition */
/**
* To maintain a logical and linear CFG without critical edges,
@ -8308,6 +8309,8 @@ static void visit_if(isel_context *ctx, nir_if *if_stmt)
visit_cf_list(ctx, &if_stmt->else_list);
end_divergent_if(ctx, &ic);
return true;
}
}
@ -8320,7 +8323,8 @@ static void visit_cf_list(isel_context *ctx,
visit_block(ctx, nir_cf_node_as_block(node));
break;
case nir_cf_node_if:
visit_if(ctx, nir_cf_node_as_if(node));
if (!visit_if(ctx, nir_cf_node_as_if(node)))
return;
break;
case nir_cf_node_loop:
visit_loop(ctx, nir_cf_node_as_loop(node));