About Social Code
aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Seurer <konstantin.seurer@gmail.com>2025-07-30 22:38:44 +0200
committerMarge Bot <marge-bot@fdo.invalid>2025-11-04 18:51:51 +0000
commitb962063d723584f979be997e91e9a87ed622cebf (patch)
treedd066ccc7dfff50475dad66b05a1cb9aab125d78
parent3f3faa82b8eb9651a08899325a00567c2507f49e (diff)
nir: Remove nir_parallel_copy_instr
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36483>
-rw-r--r--src/broadcom/compiler/vir.c1
-rw-r--r--src/compiler/nir/nir.c15
-rw-r--r--src/compiler/nir/nir.h31
-rw-r--r--src/compiler/nir/nir_clone.c2
-rw-r--r--src/compiler/nir/nir_defines.h1
-rw-r--r--src/compiler/nir/nir_divergence_analysis.c2
-rw-r--r--src/compiler/nir/nir_inline_helpers.h18
-rw-r--r--src/compiler/nir/nir_instr_set.c2
-rw-r--r--src/compiler/nir/nir_opt_dce.c8
-rw-r--r--src/compiler/nir/nir_opt_move_discards_to_top.c3
-rw-r--r--src/compiler/nir/nir_opt_peephole_select.c1
-rw-r--r--src/compiler/nir/nir_print.c27
-rw-r--r--src/compiler/nir/nir_propagate_invariant.c1
-rw-r--r--src/compiler/nir/nir_schedule.c5
-rw-r--r--src/compiler/nir/nir_serialize.c4
-rw-r--r--src/freedreno/ir3/ir3_compiler_nir.c2
-rw-r--r--src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c3
-rw-r--r--src/kosmickrisp/compiler/nir_to_msl.c1
18 files changed, 0 insertions, 127 deletions
diff --git a/src/broadcom/compiler/vir.c b/src/broadcom/compiler/vir.c
index 39d3f5e454b..e50442e5089 100644
--- a/src/broadcom/compiler/vir.c
+++ b/src/broadcom/compiler/vir.c
@@ -1347,7 +1347,6 @@ v3d_instr_delay_cb(nir_instr *instr, void *data)
case nir_instr_type_alu:
case nir_instr_type_deref:
case nir_instr_type_jump:
- case nir_instr_type_parallel_copy:
case nir_instr_type_call:
case nir_instr_type_phi:
return 1;
diff --git a/src/compiler/nir/nir.c b/src/compiler/nir/nir.c
index 5aa180a883e..9a5fde301ac 100644
--- a/src/compiler/nir/nir.c
+++ b/src/compiler/nir/nir.c
@@ -1018,17 +1018,6 @@ nir_phi_instr_add_src(nir_phi_instr *instr, nir_block *pred, nir_def *src)
return phi_src;
}
-nir_parallel_copy_instr *
-nir_parallel_copy_instr_create(nir_shader *shader)
-{
- nir_parallel_copy_instr *instr =
- nir_instr_create(shader, nir_instr_type_parallel_copy, sizeof(nir_parallel_copy_instr));
-
- exec_list_make_empty(&instr->entries);
-
- return instr;
-}
-
nir_undef_instr *
nir_undef_instr_create(nir_shader *shader,
unsigned num_components,
@@ -1484,9 +1473,6 @@ nir_instr_def(nir_instr *instr)
case nir_instr_type_phi:
return &nir_instr_as_phi(instr)->def;
- case nir_instr_type_parallel_copy:
- UNREACHABLE("Parallel copies are unsupported by this function");
-
case nir_instr_type_load_const:
return &nir_instr_as_load_const(instr)->def;
@@ -2898,7 +2884,6 @@ nir_instr_can_speculate(nir_instr *instr)
case nir_instr_type_call:
case nir_instr_type_jump:
case nir_instr_type_phi:
- case nir_instr_type_parallel_copy:
return false;
}
diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h
index e327e23e0d3..05b9a4c76e0 100644
--- a/src/compiler/nir/nir.h
+++ b/src/compiler/nir/nir.h
@@ -946,7 +946,6 @@ typedef enum ENUM_PACKED {
nir_instr_type_jump,
nir_instr_type_undef,
nir_instr_type_phi,
- nir_instr_type_parallel_copy,
} nir_instr_type;
typedef struct nir_instr {
@@ -2779,31 +2778,6 @@ nir_phi_get_src_from_block(nir_phi_instr *phi, nir_block *block)
return NULL;
}
-typedef struct nir_parallel_copy_entry {
- struct exec_node node;
- bool src_is_reg;
- bool dest_is_reg;
- nir_src src;
- union {
- nir_def def;
- nir_src reg;
- } dest;
-} nir_parallel_copy_entry;
-
-#define nir_foreach_parallel_copy_entry(entry, pcopy) \
- foreach_list_typed(nir_parallel_copy_entry, entry, node, &(pcopy)->entries)
-
-typedef struct nir_parallel_copy_instr {
- nir_instr instr;
-
- /* A list of nir_parallel_copy_entrys. The sources of all of the
- * entries are copied to the corresponding destinations "in parallel".
- * In other words, if we have two entries: a -> b and b -> a, the values
- * get swapped.
- */
- struct exec_list entries;
-} nir_parallel_copy_instr;
-
/* This struct contains metadata for correlating the final nir shader
* (after many lowering and optimization passes) with the source spir-v
* or glsl. To avoid adding unnecessary overhead when the driver does not
@@ -2856,9 +2830,6 @@ NIR_DEFINE_CAST(nir_instr_as_undef, nir_instr, nir_undef_instr, instr,
type, nir_instr_type_undef)
NIR_DEFINE_CAST(nir_instr_as_phi, nir_instr, nir_phi_instr, instr,
type, nir_instr_type_phi)
-NIR_DEFINE_CAST(nir_instr_as_parallel_copy, nir_instr,
- nir_parallel_copy_instr, instr,
- type, nir_instr_type_parallel_copy)
#define NIR_DEFINE_DEF_AS_INSTR(type, suffix) \
static inline type *nir_def_as_##suffix(const nir_def *def) \
@@ -4121,8 +4092,6 @@ nir_phi_instr *nir_phi_instr_create(nir_shader *shader);
nir_phi_src *nir_phi_instr_add_src(nir_phi_instr *instr,
nir_block *pred, nir_def *src);
-nir_parallel_copy_instr *nir_parallel_copy_instr_create(nir_shader *shader);
-
nir_undef_instr *nir_undef_instr_create(nir_shader *shader,
unsigned num_components,
unsigned bit_size);
diff --git a/src/compiler/nir/nir_clone.c b/src/compiler/nir/nir_clone.c
index 2ad4867a21e..204fbfddad4 100644
--- a/src/compiler/nir/nir_clone.c
+++ b/src/compiler/nir/nir_clone.c
@@ -511,8 +511,6 @@ clone_instr(clone_state *state, const nir_instr *instr)
return &clone_jump(state, nir_instr_as_jump(instr))->instr;
case nir_instr_type_call:
return &clone_call(state, nir_instr_as_call(instr))->instr;
- case nir_instr_type_parallel_copy:
- UNREACHABLE("Cannot clone parallel copies");
default:
UNREACHABLE("bad instr type");
return NULL;
diff --git a/src/compiler/nir/nir_defines.h b/src/compiler/nir/nir_defines.h
index b3e80006d8c..4c4f78c8c9d 100644
--- a/src/compiler/nir/nir_defines.h
+++ b/src/compiler/nir/nir_defines.h
@@ -52,7 +52,6 @@ typedef struct nir_intrinsic_instr nir_intrinsic_instr;
typedef struct nir_load_const_instr nir_load_const_instr;
typedef struct nir_undef_instr nir_undef_instr;
typedef struct nir_phi_instr nir_phi_instr;
-typedef struct nir_parallel_copy_instr nir_parallel_copy_instr;
typedef struct nir_xfb_info nir_xfb_info;
typedef struct nir_tcs_info nir_tcs_info;
diff --git a/src/compiler/nir/nir_divergence_analysis.c b/src/compiler/nir/nir_divergence_analysis.c
index 89af52ffd43..7df2aea5c5b 100644
--- a/src/compiler/nir/nir_divergence_analysis.c
+++ b/src/compiler/nir/nir_divergence_analysis.c
@@ -1215,7 +1215,6 @@ instr_is_loop_invariant(nir_instr *instr, struct divergence_state *state)
case nir_instr_type_call:
return false;
case nir_instr_type_phi:
- case nir_instr_type_parallel_copy:
default:
UNREACHABLE("NIR divergence analysis: Unsupported instruction type.");
}
@@ -1241,7 +1240,6 @@ update_instr_divergence(nir_instr *instr, struct divergence_state *state)
return false;
case nir_instr_type_jump:
case nir_instr_type_phi:
- case nir_instr_type_parallel_copy:
default:
UNREACHABLE("NIR divergence analysis: Unsupported instruction type.");
}
diff --git a/src/compiler/nir/nir_inline_helpers.h b/src/compiler/nir/nir_inline_helpers.h
index 4022a78da1e..16cc160e8ab 100644
--- a/src/compiler/nir/nir_inline_helpers.h
+++ b/src/compiler/nir/nir_inline_helpers.h
@@ -19,14 +19,6 @@ _nir_foreach_def(nir_instr *instr, nir_foreach_def_cb cb, void *state)
return cb(&nir_instr_as_tex(instr)->def, state);
case nir_instr_type_phi:
return cb(&nir_instr_as_phi(instr)->def, state);
- case nir_instr_type_parallel_copy: {
- nir_foreach_parallel_copy_entry(entry, nir_instr_as_parallel_copy(instr)) {
- if (!entry->dest_is_reg && !cb(&entry->dest.def, state))
- return false;
- }
- return true;
- }
-
case nir_instr_type_load_const:
return cb(&nir_instr_as_load_const(instr)->def, state);
case nir_instr_type_undef:
@@ -116,16 +108,6 @@ nir_foreach_src(nir_instr *instr, nir_foreach_src_cb cb, void *state)
}
break;
}
- case nir_instr_type_parallel_copy: {
- nir_parallel_copy_instr *pc = nir_instr_as_parallel_copy(instr);
- nir_foreach_parallel_copy_entry(entry, pc) {
- if (!_nir_visit_src(&entry->src, cb, state))
- return false;
- if (entry->dest_is_reg && !_nir_visit_src(&entry->dest.reg, cb, state))
- return false;
- }
- break;
- }
case nir_instr_type_jump: {
nir_jump_instr *jump = nir_instr_as_jump(instr);
diff --git a/src/compiler/nir/nir_instr_set.c b/src/compiler/nir/nir_instr_set.c
index 64687a69214..89b1332c106 100644
--- a/src/compiler/nir/nir_instr_set.c
+++ b/src/compiler/nir/nir_instr_set.c
@@ -78,7 +78,6 @@ instr_can_rewrite(const nir_instr *instr)
case nir_instr_type_jump:
case nir_instr_type_undef:
return false;
- case nir_instr_type_parallel_copy:
default:
UNREACHABLE("Invalid instruction type");
}
@@ -757,7 +756,6 @@ nir_instrs_equal(const nir_instr *instr1, const nir_instr *instr2)
case nir_instr_type_call:
case nir_instr_type_jump:
case nir_instr_type_undef:
- case nir_instr_type_parallel_copy:
default:
UNREACHABLE("Invalid instruction type");
}
diff --git a/src/compiler/nir/nir_opt_dce.c b/src/compiler/nir/nir_opt_dce.c
index 5ec3c959d8a..a61e6964c56 100644
--- a/src/compiler/nir/nir_opt_dce.c
+++ b/src/compiler/nir/nir_opt_dce.c
@@ -88,14 +88,6 @@ is_live(BITSET_WORD *defs_live, nir_instr *instr)
nir_undef_instr *undef = nir_instr_as_undef(instr);
return is_def_live(&undef->def, defs_live);
}
- case nir_instr_type_parallel_copy: {
- nir_parallel_copy_instr *pc = nir_instr_as_parallel_copy(instr);
- nir_foreach_parallel_copy_entry(entry, pc) {
- if (entry->dest_is_reg || is_def_live(&entry->dest.def, defs_live))
- return true;
- }
- return false;
- }
default:
UNREACHABLE("unexpected instr type");
}
diff --git a/src/compiler/nir/nir_opt_move_discards_to_top.c b/src/compiler/nir/nir_opt_move_discards_to_top.c
index 75c5c4b78b8..fb0a5ab57e7 100644
--- a/src/compiler/nir/nir_opt_move_discards_to_top.c
+++ b/src/compiler/nir/nir_opt_move_discards_to_top.c
@@ -288,9 +288,6 @@ opt_move_discards_to_top_impl(nir_function_impl *impl)
}
continue;
}
-
- case nir_instr_type_parallel_copy:
- UNREACHABLE("Unhanded instruction type");
}
}
}
diff --git a/src/compiler/nir/nir_opt_peephole_select.c b/src/compiler/nir/nir_opt_peephole_select.c
index 1a45de6787b..e9a5ca1fc51 100644
--- a/src/compiler/nir/nir_opt_peephole_select.c
+++ b/src/compiler/nir/nir_opt_peephole_select.c
@@ -93,7 +93,6 @@ block_check_for_allowed_instrs(nir_block *block, unsigned *count,
case nir_instr_type_call:
case nir_instr_type_jump:
- case nir_instr_type_parallel_copy:
return false;
}
}
diff --git a/src/compiler/nir/nir_print.c b/src/compiler/nir/nir_print.c
index e3b9947b270..2197bc572fd 100644
--- a/src/compiler/nir/nir_print.c
+++ b/src/compiler/nir/nir_print.c
@@ -2121,28 +2121,6 @@ print_phi_instr(nir_phi_instr *instr, print_state *state)
}
static void
-print_parallel_copy_instr(nir_parallel_copy_instr *instr, print_state *state)
-{
- FILE *fp = state->fp;
- nir_foreach_parallel_copy_entry(entry, instr) {
- if (&entry->node != exec_list_get_head(&instr->entries))
- fprintf(fp, "; ");
-
- if (entry->dest_is_reg) {
- fprintf(fp, "*");
- print_src(&entry->dest.reg, state, nir_type_invalid);
- } else {
- print_def(&entry->dest.def, state);
- }
- fprintf(fp, " = ");
-
- if (entry->src_is_reg)
- fprintf(fp, "*");
- print_src(&entry->src, state, nir_type_invalid);
- }
-}
-
-static void
print_instr(const nir_instr *instr, print_state *state, unsigned tabs)
{
FILE *fp = state->fp;
@@ -2214,10 +2192,6 @@ print_instr(const nir_instr *instr, print_state *state, unsigned tabs)
print_phi_instr(nir_instr_as_phi(instr), state);
break;
- case nir_instr_type_parallel_copy:
- print_parallel_copy_instr(nir_instr_as_parallel_copy(instr), state);
- break;
-
default:
UNREACHABLE("Invalid instruction type");
break;
@@ -2238,7 +2212,6 @@ block_has_instruction_with_dest(nir_block *block)
case nir_instr_type_tex:
case nir_instr_type_undef:
case nir_instr_type_phi:
- case nir_instr_type_parallel_copy:
return true;
case nir_instr_type_intrinsic: {
diff --git a/src/compiler/nir/nir_propagate_invariant.c b/src/compiler/nir/nir_propagate_invariant.c
index f29f8832b43..096532842b6 100644
--- a/src/compiler/nir/nir_propagate_invariant.c
+++ b/src/compiler/nir/nir_propagate_invariant.c
@@ -143,7 +143,6 @@ propagate_invariant_instr(nir_instr *instr, struct set *invariants)
case nir_instr_type_call:
UNREACHABLE("This pass must be run after function inlining");
- case nir_instr_type_parallel_copy:
default:
UNREACHABLE("Cannot have this instruction type");
}
diff --git a/src/compiler/nir/nir_schedule.c b/src/compiler/nir/nir_schedule.c
index f0340c949ab..967f5b389f9 100644
--- a/src/compiler/nir/nir_schedule.c
+++ b/src/compiler/nir/nir_schedule.c
@@ -480,10 +480,6 @@ nir_schedule_calculate_deps(nir_deps_state *state, nir_schedule_node *n)
UNREACHABLE("Calls should have been lowered");
break;
- case nir_instr_type_parallel_copy:
- UNREACHABLE("Parallel copies should have been lowered");
- break;
-
case nir_instr_type_phi:
UNREACHABLE("nir_schedule() should be called after lowering from SSA");
break;
@@ -1093,7 +1089,6 @@ nir_schedule_get_delay(nir_schedule_scoreboard *scoreboard, nir_instr *instr)
case nir_instr_type_alu:
case nir_instr_type_deref:
case nir_instr_type_jump:
- case nir_instr_type_parallel_copy:
case nir_instr_type_call:
case nir_instr_type_phi:
return 1;
diff --git a/src/compiler/nir/nir_serialize.c b/src/compiler/nir/nir_serialize.c
index f8194e1863a..8cd048d0a44 100644
--- a/src/compiler/nir/nir_serialize.c
+++ b/src/compiler/nir/nir_serialize.c
@@ -1717,8 +1717,6 @@ write_instr(write_ctx *ctx, const nir_instr *instr)
blob_write_uint32(ctx->blob, instr->type);
write_call(ctx, nir_instr_as_call(instr));
break;
- case nir_instr_type_parallel_copy:
- UNREACHABLE("Cannot write parallel copies");
default:
UNREACHABLE("bad instr type");
}
@@ -1771,8 +1769,6 @@ read_instr(read_ctx *ctx, nir_block *block)
case nir_instr_type_call:
instr = &read_call(ctx)->instr;
break;
- case nir_instr_type_parallel_copy:
- UNREACHABLE("Cannot read parallel copies");
default:
UNREACHABLE("bad instr type");
}
diff --git a/src/freedreno/ir3/ir3_compiler_nir.c b/src/freedreno/ir3/ir3_compiler_nir.c
index 7978b845291..29ee968a4f7 100644
--- a/src/freedreno/ir3/ir3_compiler_nir.c
+++ b/src/freedreno/ir3/ir3_compiler_nir.c
@@ -4296,7 +4296,6 @@ emit_instr(struct ir3_context *ctx, nir_instr *instr)
emit_phi(ctx, nir_instr_as_phi(instr));
break;
case nir_instr_type_call:
- case nir_instr_type_parallel_copy:
ir3_context_error(ctx, "Unhandled NIR instruction type: %d\n",
instr->type);
break;
@@ -4466,7 +4465,6 @@ instr_can_be_predicated(nir_instr *instr)
case nir_instr_type_load_const:
case nir_instr_type_undef:
case nir_instr_type_phi:
- case nir_instr_type_parallel_copy:
return true;
case nir_instr_type_call:
case nir_instr_type_jump:
diff --git a/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c b/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c
index 021416d7cec..9c43ebd5291 100644
--- a/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c
+++ b/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c
@@ -4522,9 +4522,6 @@ emit_block(struct ntv_context *ctx, struct nir_block *block)
case nir_instr_type_call:
UNREACHABLE("nir_instr_type_call not supported");
break;
- case nir_instr_type_parallel_copy:
- UNREACHABLE("nir_instr_type_parallel_copy not supported");
- break;
case nir_instr_type_deref:
emit_deref(ctx, nir_instr_as_deref(instr));
break;
diff --git a/src/kosmickrisp/compiler/nir_to_msl.c b/src/kosmickrisp/compiler/nir_to_msl.c
index cc8d352352f..3fd3f375ffd 100644
--- a/src/kosmickrisp/compiler/nir_to_msl.c
+++ b/src/kosmickrisp/compiler/nir_to_msl.c
@@ -1749,7 +1749,6 @@ instr_to_msl(struct nir_to_msl_ctx *ctx, nir_instr *instr)
// undefs get inlined into their uses (and we shouldn't see them hopefully)
break;
case nir_instr_type_phi:
- case nir_instr_type_parallel_copy:
assert(!"NIR should be taken out of SSA");
break;
}