mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-25 17:20:10 +01:00
nir: Use nir_block_last_phi_instr more
We have a helper, don't open code it. Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com> Reviewed-by: Jesse Natalie <jenatali@microsoft.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22967>
This commit is contained in:
parent
82430b91bb
commit
7dfa98abc6
2 changed files with 4 additions and 13 deletions
|
|
@ -376,13 +376,9 @@ get_parallel_copy_at_end_of_block(nir_block *block)
|
|||
static bool
|
||||
isolate_phi_nodes_block(nir_shader *shader, nir_block *block, void *dead_ctx)
|
||||
{
|
||||
nir_instr *last_phi_instr = NULL;
|
||||
nir_foreach_phi(phi, block) {
|
||||
last_phi_instr = &phi->instr;
|
||||
}
|
||||
|
||||
/* If we don't have any phis, then there's nothing for us to do. */
|
||||
if (last_phi_instr == NULL)
|
||||
nir_phi_instr *last_phi = nir_block_last_phi_instr(block);
|
||||
if (last_phi == NULL)
|
||||
return true;
|
||||
|
||||
/* If we have phi nodes, we need to create a parallel copy at the
|
||||
|
|
@ -390,7 +386,7 @@ isolate_phi_nodes_block(nir_shader *shader, nir_block *block, void *dead_ctx)
|
|||
*/
|
||||
nir_parallel_copy_instr *block_pcopy =
|
||||
nir_parallel_copy_instr_create(shader);
|
||||
nir_instr_insert_after(last_phi_instr, &block_pcopy->instr);
|
||||
nir_instr_insert_after(&last_phi->instr, &block_pcopy->instr);
|
||||
|
||||
nir_foreach_phi(phi, block) {
|
||||
assert(phi->dest.is_ssa);
|
||||
|
|
|
|||
|
|
@ -186,12 +186,7 @@ lower_phis_to_scalar_block(nir_block *block,
|
|||
struct lower_phis_to_scalar_state *state)
|
||||
{
|
||||
bool progress = false;
|
||||
|
||||
/* Find the last phi node in the block */
|
||||
nir_phi_instr *last_phi = NULL;
|
||||
nir_foreach_phi(phi, block) {
|
||||
last_phi = phi;
|
||||
}
|
||||
nir_phi_instr *last_phi = nir_block_last_phi_instr(block);
|
||||
|
||||
/* We have to handle the phi nodes in their own pass due to the way
|
||||
* we're modifying the linked list of instructions.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue