From 29b2ace18454e8d1b06f938132a30710e899dc1c Mon Sep 17 00:00:00 2001 From: Faith Ekstrand Date: Wed, 31 May 2023 13:55:47 -0500 Subject: [PATCH] nir/from_ssa: Make additional assumptions in coalescing At this point, everything is SSA. Also, NIR no longer allows different numbers of components on the two sides of a phi so we can just assert rather than trying to gracefully handle mismatches. Reviewed-by: Alyssa Rosenzweig Part-of: --- src/compiler/nir/nir_from_ssa.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/compiler/nir/nir_from_ssa.c b/src/compiler/nir/nir_from_ssa.c index 5d216ca88b6..9375802463e 100644 --- a/src/compiler/nir/nir_from_ssa.c +++ b/src/compiler/nir/nir_from_ssa.c @@ -457,8 +457,9 @@ aggressive_coalesce_parallel_copy(nir_parallel_copy_instr *pcopy, struct from_ssa_state *state) { nir_foreach_parallel_copy_entry(entry, pcopy) { - if (!entry->src.is_ssa) - continue; + assert(entry->src.is_ssa); + assert(entry->dest.is_ssa); + assert(entry->dest.ssa.num_components == entry->src.ssa->num_components); /* Since load_const instructions are SSA only, we can't replace their * destinations with registers and, therefore, can't coalesce them. @@ -466,10 +467,6 @@ aggressive_coalesce_parallel_copy(nir_parallel_copy_instr *pcopy, if (entry->src.ssa->parent_instr->type == nir_instr_type_load_const) continue; - /* Don't try and coalesce these */ - if (entry->dest.ssa.num_components != entry->src.ssa->num_components) - continue; - merge_node *src_node = get_merge_node(entry->src.ssa, state); merge_node *dest_node = get_merge_node(&entry->dest.ssa, state);