summaryrefslogtreecommitdiffstats
path: root/src/compiler/nir
diff options
context:
space:
mode:
Diffstat (limited to 'src/compiler/nir')
-rw-r--r--src/compiler/nir/nir.c1
-rw-r--r--src/compiler/nir/nir.h12
-rw-r--r--src/compiler/nir/nir_clone.c1
-rw-r--r--src/compiler/nir/nir_deref.c2
-rw-r--r--src/compiler/nir/nir_gather_info.c2
-rw-r--r--src/compiler/nir/nir_linking_helpers.c2
-rw-r--r--src/compiler/nir/nir_loop_analyze.c1
-rw-r--r--src/compiler/nir/nir_lower_alpha_test.c2
-rw-r--r--src/compiler/nir/nir_lower_clamp_color_outputs.c2
-rw-r--r--src/compiler/nir/nir_lower_clip_cull_distance_arrays.c2
-rw-r--r--src/compiler/nir/nir_lower_drawpixels.c5
-rw-r--r--src/compiler/nir/nir_lower_global_vars_to_local.c3
-rw-r--r--src/compiler/nir/nir_lower_indirect_derefs.c2
-rw-r--r--src/compiler/nir/nir_lower_io.c2
-rw-r--r--src/compiler/nir/nir_lower_io_arrays_to_elements.c5
-rw-r--r--src/compiler/nir/nir_lower_io_to_scalar.c2
-rw-r--r--src/compiler/nir/nir_lower_io_types.c2
-rw-r--r--src/compiler/nir/nir_lower_locals_to_regs.c2
-rw-r--r--src/compiler/nir/nir_lower_phis_to_scalar.c2
-rw-r--r--src/compiler/nir/nir_lower_system_values.c2
-rw-r--r--src/compiler/nir/nir_lower_tex.c2
-rw-r--r--src/compiler/nir/nir_lower_var_copies.c2
-rw-r--r--src/compiler/nir/nir_lower_vars_to_ssa.c2
-rw-r--r--src/compiler/nir/nir_lower_wpos_center.c2
-rw-r--r--src/compiler/nir/nir_lower_wpos_ytransform.c2
-rw-r--r--src/compiler/nir/nir_opt_copy_prop_vars.c2
-rw-r--r--src/compiler/nir/nir_opt_peephole_select.c2
-rw-r--r--src/compiler/nir/nir_opt_undef.c2
-rw-r--r--src/compiler/nir/nir_propagate_invariant.c2
-rw-r--r--src/compiler/nir/nir_remove_dead_variables.c2
-rw-r--r--src/compiler/nir/nir_serialize.c2
-rw-r--r--src/compiler/nir/nir_split_var_copies.c2
32 files changed, 78 insertions, 0 deletions
diff --git a/src/compiler/nir/nir.c b/src/compiler/nir/nir.c
index 40bf940ef38..d1404e82fb4 100644
--- a/src/compiler/nir/nir.c
+++ b/src/compiler/nir/nir.c
@@ -64,6 +64,7 @@ nir_shader_create(void *mem_ctx,
shader->num_outputs = 0;
shader->num_uniforms = 0;
shader->num_shared = 0;
+ shader->lowered_derefs = 0;
return shader;
}
diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h
index d25aa7491ed..0b950862334 100644
--- a/src/compiler/nir/nir.h
+++ b/src/compiler/nir/nir.h
@@ -2133,8 +2133,19 @@ typedef struct nir_shader {
* access plus one
*/
unsigned num_inputs, num_uniforms, num_outputs, num_shared;
+
+ /* temporary, tracking for which derefs instructions have been lowered
+ * to deref chains
+ */
+ unsigned lowered_derefs;
} nir_shader;
+#define nir_assert_lowered_derefs(shader, mask) \
+ assert(((shader)->lowered_derefs & (mask)) == (mask))
+
+#define nir_assert_unlowered_derefs(shader, mask) \
+ assert(!((shader)->lowered_derefs & (mask)))
+
static inline nir_function_impl *
nir_shader_get_entrypoint(nir_shader *shader)
{
@@ -2681,6 +2692,7 @@ enum nir_lower_deref_flags {
nir_lower_atomic_counter_derefs = (1 << 3),
nir_lower_atomic_derefs = (1 << 4),
nir_lower_image_derefs = (1 << 5),
+ nir_lower_all_derefs = (1 << 6) - 1,
};
bool nir_lower_deref_instrs(nir_shader *shader,
diff --git a/src/compiler/nir/nir_clone.c b/src/compiler/nir/nir_clone.c
index 20eaaff3bee..7236f0872a7 100644
--- a/src/compiler/nir/nir_clone.c
+++ b/src/compiler/nir/nir_clone.c
@@ -816,6 +816,7 @@ nir_shader_clone(void *mem_ctx, const nir_shader *s)
ns->num_uniforms = s->num_uniforms;
ns->num_outputs = s->num_outputs;
ns->num_shared = s->num_shared;
+ ns->lowered_derefs = s->lowered_derefs;
free_clone_state(&state);
diff --git a/src/compiler/nir/nir_deref.c b/src/compiler/nir/nir_deref.c
index 0e8699aa6e6..d7b4bbcdcd6 100644
--- a/src/compiler/nir/nir_deref.c
+++ b/src/compiler/nir/nir_deref.c
@@ -350,5 +350,7 @@ nir_lower_deref_instrs(nir_shader *shader,
progress |= nir_lower_deref_instrs_impl(function->impl, flags);
}
+ shader->lowered_derefs |= flags;
+
return progress;
}
diff --git a/src/compiler/nir/nir_gather_info.c b/src/compiler/nir/nir_gather_info.c
index 3534b6949eb..4f4b650ab7e 100644
--- a/src/compiler/nir/nir_gather_info.c
+++ b/src/compiler/nir/nir_gather_info.c
@@ -397,6 +397,8 @@ glsl_type_get_image_count(const struct glsl_type *type)
void
nir_shader_gather_info(nir_shader *shader, nir_function_impl *entrypoint)
{
+ nir_assert_lowered_derefs(shader, nir_lower_load_store_derefs | nir_lower_interp_derefs);
+
shader->info.num_textures = 0;
shader->info.num_images = 0;
nir_foreach_variable(var, &shader->uniforms) {
diff --git a/src/compiler/nir/nir_linking_helpers.c b/src/compiler/nir/nir_linking_helpers.c
index 2b0a2668a33..707bce12ef9 100644
--- a/src/compiler/nir/nir_linking_helpers.c
+++ b/src/compiler/nir/nir_linking_helpers.c
@@ -133,6 +133,8 @@ nir_remove_unused_varyings(nir_shader *producer, nir_shader *consumer)
{
assert(producer->info.stage != MESA_SHADER_FRAGMENT);
assert(consumer->info.stage != MESA_SHADER_VERTEX);
+ nir_assert_lowered_derefs(producer, nir_lower_load_store_derefs);
+ nir_assert_lowered_derefs(consumer, nir_lower_load_store_derefs);
uint64_t read[4] = { 0 }, written[4] = { 0 };
uint64_t patches_read[4] = { 0 }, patches_written[4] = { 0 };
diff --git a/src/compiler/nir/nir_loop_analyze.c b/src/compiler/nir/nir_loop_analyze.c
index d5281a5faa4..870b4ffa5f0 100644
--- a/src/compiler/nir/nir_loop_analyze.c
+++ b/src/compiler/nir/nir_loop_analyze.c
@@ -827,6 +827,7 @@ void
nir_loop_analyze_impl(nir_function_impl *impl,
nir_variable_mode indirect_mask)
{
+ nir_assert_lowered_derefs(impl->function->shader, nir_lower_load_store_derefs);
nir_index_ssa_defs(impl);
foreach_list_typed(nir_cf_node, node, node, &impl->body)
process_loops(node, indirect_mask);
diff --git a/src/compiler/nir/nir_lower_alpha_test.c b/src/compiler/nir/nir_lower_alpha_test.c
index 6bf9ff142df..4dfd79873b5 100644
--- a/src/compiler/nir/nir_lower_alpha_test.c
+++ b/src/compiler/nir/nir_lower_alpha_test.c
@@ -41,6 +41,8 @@ nir_lower_alpha_test(nir_shader *shader, enum compare_func func,
{
assert(shader->info.stage == MESA_SHADER_FRAGMENT);
+ nir_assert_lowered_derefs(shader, nir_lower_load_store_derefs);
+
nir_foreach_function(function, shader) {
nir_function_impl *impl = function->impl;
nir_builder b;
diff --git a/src/compiler/nir/nir_lower_clamp_color_outputs.c b/src/compiler/nir/nir_lower_clamp_color_outputs.c
index 55becbf769e..17bda24bf74 100644
--- a/src/compiler/nir/nir_lower_clamp_color_outputs.c
+++ b/src/compiler/nir/nir_lower_clamp_color_outputs.c
@@ -134,6 +134,8 @@ nir_lower_clamp_color_outputs(nir_shader *shader)
.shader = shader,
};
+ nir_assert_lowered_derefs(shader, nir_lower_load_store_derefs);
+
nir_foreach_function(function, shader) {
if (function->impl)
progress |= lower_impl(&state, function->impl);
diff --git a/src/compiler/nir/nir_lower_clip_cull_distance_arrays.c b/src/compiler/nir/nir_lower_clip_cull_distance_arrays.c
index 95eda82139b..6a93f1c0a2d 100644
--- a/src/compiler/nir/nir_lower_clip_cull_distance_arrays.c
+++ b/src/compiler/nir/nir_lower_clip_cull_distance_arrays.c
@@ -194,6 +194,8 @@ nir_lower_clip_cull_distance_arrays(nir_shader *nir)
{
bool progress = false;
+ nir_assert_lowered_derefs(nir, nir_lower_load_store_derefs);
+
if (nir->info.stage <= MESA_SHADER_GEOMETRY)
progress |= combine_clip_cull(nir, &nir->outputs, true);
diff --git a/src/compiler/nir/nir_lower_drawpixels.c b/src/compiler/nir/nir_lower_drawpixels.c
index 5cc358d869f..fcdc0bc4b41 100644
--- a/src/compiler/nir/nir_lower_drawpixels.c
+++ b/src/compiler/nir/nir_lower_drawpixels.c
@@ -253,6 +253,11 @@ nir_lower_drawpixels(nir_shader *shader,
.shader = shader,
};
+ /* note that this pass already assumes texture/sampler derefs are already
+ * lowered to index
+ */
+ nir_assert_lowered_derefs(shader, nir_lower_load_store_derefs);
+
assert(shader->info.stage == MESA_SHADER_FRAGMENT);
nir_foreach_function(function, shader) {
diff --git a/src/compiler/nir/nir_lower_global_vars_to_local.c b/src/compiler/nir/nir_lower_global_vars_to_local.c
index c8fdfde8cb1..9b3bc4cdd23 100644
--- a/src/compiler/nir/nir_lower_global_vars_to_local.c
+++ b/src/compiler/nir/nir_lower_global_vars_to_local.c
@@ -76,6 +76,9 @@ nir_lower_global_vars_to_local(nir_shader *shader)
_mesa_hash_table_create(NULL, _mesa_hash_pointer,
_mesa_key_pointer_equal);
+ nir_assert_lowered_derefs(shader, nir_lower_load_store_derefs | nir_lower_interp_derefs |
+ nir_lower_atomic_counter_derefs | nir_lower_atomic_derefs | nir_lower_image_derefs);
+
nir_foreach_function(function, shader) {
if (function->impl) {
nir_foreach_block(block, function->impl)
diff --git a/src/compiler/nir/nir_lower_indirect_derefs.c b/src/compiler/nir/nir_lower_indirect_derefs.c
index 02f202dea39..ed27c8f8851 100644
--- a/src/compiler/nir/nir_lower_indirect_derefs.c
+++ b/src/compiler/nir/nir_lower_indirect_derefs.c
@@ -211,6 +211,8 @@ nir_lower_indirect_derefs(nir_shader *shader, nir_variable_mode modes)
{
bool progress = false;
+ nir_assert_lowered_derefs(shader, nir_lower_load_store_derefs | nir_lower_interp_derefs);
+
nir_foreach_function(function, shader) {
if (function->impl)
progress = lower_indirects_impl(function->impl, modes) || progress;
diff --git a/src/compiler/nir/nir_lower_io.c b/src/compiler/nir/nir_lower_io.c
index df91febd68d..7ec2df1d441 100644
--- a/src/compiler/nir/nir_lower_io.c
+++ b/src/compiler/nir/nir_lower_io.c
@@ -511,6 +511,8 @@ nir_lower_io(nir_shader *shader, nir_variable_mode modes,
{
bool progress = false;
+ nir_assert_lowered_derefs(shader, nir_lower_load_store_derefs | nir_lower_interp_derefs | nir_lower_atomic_derefs);
+
nir_foreach_function(function, shader) {
if (function->impl) {
progress |= nir_lower_io_impl(function->impl, modes,
diff --git a/src/compiler/nir/nir_lower_io_arrays_to_elements.c b/src/compiler/nir/nir_lower_io_arrays_to_elements.c
index 9a5eec8f870..c9c6c95440e 100644
--- a/src/compiler/nir/nir_lower_io_arrays_to_elements.c
+++ b/src/compiler/nir/nir_lower_io_arrays_to_elements.c
@@ -356,6 +356,8 @@ nir_lower_io_arrays_to_elements_no_indirects(nir_shader *shader,
_mesa_hash_table_create(NULL, _mesa_hash_pointer,
_mesa_key_pointer_equal);
+ nir_assert_lowered_derefs(shader, nir_lower_load_store_derefs | nir_lower_interp_derefs);
+
uint64_t indirects[4] = {0}, patch_indirects[4] = {0};
lower_io_arrays_to_elements(shader, nir_var_shader_out, indirects,
@@ -398,6 +400,9 @@ nir_lower_io_arrays_to_elements(nir_shader *producer, nir_shader *consumer)
_mesa_hash_table_create(NULL, _mesa_hash_pointer,
_mesa_key_pointer_equal);
+ nir_assert_lowered_derefs(producer, nir_lower_load_store_derefs | nir_lower_interp_derefs);
+ nir_assert_lowered_derefs(consumer, nir_lower_load_store_derefs | nir_lower_interp_derefs);
+
uint64_t indirects[4] = {0}, patch_indirects[4] = {0};
create_indirects_mask(producer, indirects, patch_indirects,
nir_var_shader_out);
diff --git a/src/compiler/nir/nir_lower_io_to_scalar.c b/src/compiler/nir/nir_lower_io_to_scalar.c
index 7774c2d2458..0dc135e13b8 100644
--- a/src/compiler/nir/nir_lower_io_to_scalar.c
+++ b/src/compiler/nir/nir_lower_io_to_scalar.c
@@ -289,6 +289,8 @@ nir_lower_io_to_scalar_early(nir_shader *shader, nir_variable_mode mask)
_mesa_hash_table_create(NULL, _mesa_hash_pointer,
_mesa_key_pointer_equal);
+ nir_assert_lowered_derefs(shader, nir_lower_load_store_derefs | nir_lower_interp_derefs);
+
nir_foreach_function(function, shader) {
if (function->impl) {
nir_builder b;
diff --git a/src/compiler/nir/nir_lower_io_types.c b/src/compiler/nir/nir_lower_io_types.c
index 795bbd80d5d..bbdbcdae00f 100644
--- a/src/compiler/nir/nir_lower_io_types.c
+++ b/src/compiler/nir/nir_lower_io_types.c
@@ -161,6 +161,8 @@ nir_lower_io_types(nir_shader *shader)
{
struct lower_io_types_state state;
+ nir_assert_lowered_derefs(shader, nir_lower_load_store_derefs);
+
state.shader = shader;
exec_list_make_empty(&state.new_ins);
exec_list_make_empty(&state.new_outs);
diff --git a/src/compiler/nir/nir_lower_locals_to_regs.c b/src/compiler/nir/nir_lower_locals_to_regs.c
index d0667bc5040..822c443762f 100644
--- a/src/compiler/nir/nir_lower_locals_to_regs.c
+++ b/src/compiler/nir/nir_lower_locals_to_regs.c
@@ -292,6 +292,8 @@ nir_lower_locals_to_regs(nir_shader *shader)
{
bool progress = false;
+ nir_assert_lowered_derefs(shader, nir_lower_load_store_derefs);
+
nir_foreach_function(function, shader) {
if (function->impl)
progress = nir_lower_locals_to_regs_impl(function->impl) || progress;
diff --git a/src/compiler/nir/nir_lower_phis_to_scalar.c b/src/compiler/nir/nir_lower_phis_to_scalar.c
index b12718f2732..d055e781074 100644
--- a/src/compiler/nir/nir_lower_phis_to_scalar.c
+++ b/src/compiler/nir/nir_lower_phis_to_scalar.c
@@ -299,6 +299,8 @@ nir_lower_phis_to_scalar(nir_shader *shader)
{
bool progress = false;
+ nir_assert_lowered_derefs(shader, nir_lower_load_store_derefs);
+
nir_foreach_function(function, shader) {
if (function->impl)
progress = lower_phis_to_scalar_impl(function->impl) || progress;
diff --git a/src/compiler/nir/nir_lower_system_values.c b/src/compiler/nir/nir_lower_system_values.c
index 487da042620..dc71a8c8d87 100644
--- a/src/compiler/nir/nir_lower_system_values.c
+++ b/src/compiler/nir/nir_lower_system_values.c
@@ -203,6 +203,8 @@ nir_lower_system_values(nir_shader *shader)
{
bool progress = false;
+ nir_assert_lowered_derefs(shader, nir_lower_load_store_derefs);
+
nir_foreach_function(function, shader) {
if (function->impl)
progress = convert_impl(function->impl) || progress;
diff --git a/src/compiler/nir/nir_lower_tex.c b/src/compiler/nir/nir_lower_tex.c
index 1062afd97f0..f4c3c9c743d 100644
--- a/src/compiler/nir/nir_lower_tex.c
+++ b/src/compiler/nir/nir_lower_tex.c
@@ -865,6 +865,8 @@ nir_lower_tex(nir_shader *shader, const nir_lower_tex_options *options)
{
bool progress = false;
+ nir_assert_lowered_derefs(shader, nir_lower_texture_derefs);
+
nir_foreach_function(function, shader) {
if (function->impl)
progress |= nir_lower_tex_impl(function->impl, options);
diff --git a/src/compiler/nir/nir_lower_var_copies.c b/src/compiler/nir/nir_lower_var_copies.c
index 6288bdc465b..e7b2bd5a236 100644
--- a/src/compiler/nir/nir_lower_var_copies.c
+++ b/src/compiler/nir/nir_lower_var_copies.c
@@ -192,6 +192,8 @@ nir_lower_var_copies(nir_shader *shader)
{
bool progress = false;
+ nir_assert_lowered_derefs(shader, nir_lower_load_store_derefs);
+
nir_foreach_function(function, shader) {
if (function->impl)
progress |= lower_var_copies_impl(function->impl);
diff --git a/src/compiler/nir/nir_lower_vars_to_ssa.c b/src/compiler/nir/nir_lower_vars_to_ssa.c
index 8bc847fd41e..27f0ccb9572 100644
--- a/src/compiler/nir/nir_lower_vars_to_ssa.c
+++ b/src/compiler/nir/nir_lower_vars_to_ssa.c
@@ -737,6 +737,8 @@ nir_lower_vars_to_ssa(nir_shader *shader)
{
bool progress = false;
+ nir_assert_lowered_derefs(shader, nir_lower_load_store_derefs);
+
nir_foreach_function(function, shader) {
if (function->impl)
progress |= nir_lower_vars_to_ssa_impl(function->impl);
diff --git a/src/compiler/nir/nir_lower_wpos_center.c b/src/compiler/nir/nir_lower_wpos_center.c
index dca810d735e..fa225992e3e 100644
--- a/src/compiler/nir/nir_lower_wpos_center.c
+++ b/src/compiler/nir/nir_lower_wpos_center.c
@@ -107,6 +107,8 @@ nir_lower_wpos_center(nir_shader *shader, const bool for_sample_shading)
assert(shader->info.stage == MESA_SHADER_FRAGMENT);
+ nir_assert_lowered_derefs(shader, nir_lower_load_store_derefs);
+
nir_foreach_function(function, shader) {
if (function->impl) {
nir_builder_init(&b, function->impl);
diff --git a/src/compiler/nir/nir_lower_wpos_ytransform.c b/src/compiler/nir/nir_lower_wpos_ytransform.c
index 62166e78746..9cb5c71b560 100644
--- a/src/compiler/nir/nir_lower_wpos_ytransform.c
+++ b/src/compiler/nir/nir_lower_wpos_ytransform.c
@@ -352,6 +352,8 @@ nir_lower_wpos_ytransform(nir_shader *shader,
.shader = shader,
};
+ nir_assert_lowered_derefs(shader, nir_lower_load_store_derefs);
+
assert(shader->info.stage == MESA_SHADER_FRAGMENT);
nir_foreach_function(function, shader) {
diff --git a/src/compiler/nir/nir_opt_copy_prop_vars.c b/src/compiler/nir/nir_opt_copy_prop_vars.c
index cc8f00f9d37..2e1a2e0cd68 100644
--- a/src/compiler/nir/nir_opt_copy_prop_vars.c
+++ b/src/compiler/nir/nir_opt_copy_prop_vars.c
@@ -768,6 +768,8 @@ nir_opt_copy_prop_vars(nir_shader *shader)
{
struct copy_prop_var_state state;
+ nir_assert_lowered_derefs(shader, nir_lower_load_store_derefs);
+
state.shader = shader;
state.mem_ctx = ralloc_context(NULL);
list_inithead(&state.copies);
diff --git a/src/compiler/nir/nir_opt_peephole_select.c b/src/compiler/nir/nir_opt_peephole_select.c
index 4ca4f80d788..24a232ece89 100644
--- a/src/compiler/nir/nir_opt_peephole_select.c
+++ b/src/compiler/nir/nir_opt_peephole_select.c
@@ -255,6 +255,8 @@ nir_opt_peephole_select(nir_shader *shader, unsigned limit)
{
bool progress = false;
+ nir_assert_lowered_derefs(shader, nir_lower_load_store_derefs);
+
nir_foreach_function(function, shader) {
if (function->impl)
progress |= nir_opt_peephole_select_impl(function->impl, limit);
diff --git a/src/compiler/nir/nir_opt_undef.c b/src/compiler/nir/nir_opt_undef.c
index 8d3210c637e..b34437746f6 100644
--- a/src/compiler/nir/nir_opt_undef.c
+++ b/src/compiler/nir/nir_opt_undef.c
@@ -133,6 +133,8 @@ nir_opt_undef(nir_shader *shader)
nir_builder b;
bool progress = false;
+ nir_assert_lowered_derefs(shader, nir_lower_load_store_derefs);
+
nir_foreach_function(function, shader) {
if (function->impl) {
nir_builder_init(&b, function->impl);
diff --git a/src/compiler/nir/nir_propagate_invariant.c b/src/compiler/nir/nir_propagate_invariant.c
index 7b5bd6cce6b..d8dc6a03689 100644
--- a/src/compiler/nir/nir_propagate_invariant.c
+++ b/src/compiler/nir/nir_propagate_invariant.c
@@ -184,6 +184,8 @@ nir_propagate_invariant(nir_shader *shader)
struct set *invariants = _mesa_set_create(NULL, _mesa_hash_pointer,
_mesa_key_pointer_equal);
+ nir_assert_lowered_derefs(shader, nir_lower_load_store_derefs);
+
bool progress = false;
nir_foreach_function(function, shader) {
if (function->impl && propagate_invariant_impl(function->impl, invariants))
diff --git a/src/compiler/nir/nir_remove_dead_variables.c b/src/compiler/nir/nir_remove_dead_variables.c
index eff66f92d43..4a36ef9ba52 100644
--- a/src/compiler/nir/nir_remove_dead_variables.c
+++ b/src/compiler/nir/nir_remove_dead_variables.c
@@ -172,6 +172,8 @@ nir_remove_dead_variables(nir_shader *shader, nir_variable_mode modes)
struct set *live =
_mesa_set_create(NULL, _mesa_hash_pointer, _mesa_key_pointer_equal);
+ nir_assert_lowered_derefs(shader, nir_lower_all_derefs);
+
add_var_use_shader(shader, live, modes);
if (modes & nir_var_uniform)
diff --git a/src/compiler/nir/nir_serialize.c b/src/compiler/nir/nir_serialize.c
index 834a65b07e8..155205d2198 100644
--- a/src/compiler/nir/nir_serialize.c
+++ b/src/compiler/nir/nir_serialize.c
@@ -1215,6 +1215,7 @@ nir_serialize(struct blob *blob, const nir_shader *nir)
blob_write_uint32(blob, nir->num_uniforms);
blob_write_uint32(blob, nir->num_outputs);
blob_write_uint32(blob, nir->num_shared);
+ blob_write_uint32(blob, nir->lowered_derefs);
blob_write_uint32(blob, exec_list_length(&nir->functions));
nir_foreach_function(fxn, nir) {
@@ -1270,6 +1271,7 @@ nir_deserialize(void *mem_ctx,
ctx.nir->num_uniforms = blob_read_uint32(blob);
ctx.nir->num_outputs = blob_read_uint32(blob);
ctx.nir->num_shared = blob_read_uint32(blob);
+ ctx.nir->lowered_derefs = blob_read_uint32(blob);
unsigned num_functions = blob_read_uint32(blob);
for (unsigned i = 0; i < num_functions; i++)
diff --git a/src/compiler/nir/nir_split_var_copies.c b/src/compiler/nir/nir_split_var_copies.c
index bc3ceedbdb8..c18d77d745d 100644
--- a/src/compiler/nir/nir_split_var_copies.c
+++ b/src/compiler/nir/nir_split_var_copies.c
@@ -287,6 +287,8 @@ nir_split_var_copies(nir_shader *shader)
{
bool progress = false;
+ nir_assert_lowered_derefs(shader, nir_lower_load_store_derefs);
+
nir_foreach_function(function, shader) {
if (function->impl)
progress = split_var_copies_impl(function->impl) || progress;