summaryrefslogtreecommitdiffstats
path: root/src/compiler/nir
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2018-04-02 16:44:24 -0700
committerJason Ekstrand <[email protected]>2018-06-22 20:15:56 -0700
commit5dc58908b7cde8f23974085d1346af315d932c4e (patch)
treee7ac810e3390e73b5eee406814d06d6f3bc8093f /src/compiler/nir
parentf46ecdc44167b7c6eefac07a02c1e0f1bc41e04e (diff)
nir: Support deref instructions in opt_undef
Reviewed-by: Caio Marcelo de Oliveira Filho <[email protected]> Acked-by: Rob Clark <[email protected]> Acked-by: Bas Nieuwenhuizen <[email protected]> Acked-by: Dave Airlie <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/compiler/nir')
-rw-r--r--src/compiler/nir/nir_opt_undef.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/compiler/nir/nir_opt_undef.c b/src/compiler/nir/nir_opt_undef.c
index b34437746f6..e42a9af2bdf 100644
--- a/src/compiler/nir/nir_opt_undef.c
+++ b/src/compiler/nir/nir_opt_undef.c
@@ -107,19 +107,24 @@ opt_undef_vecN(nir_builder *b, nir_alu_instr *alu)
static bool
opt_undef_store(nir_intrinsic_instr *intrin)
{
+ int arg_index;
switch (intrin->intrinsic) {
+ case nir_intrinsic_store_deref:
+ arg_index = 1;
+ break;
case nir_intrinsic_store_var:
case nir_intrinsic_store_output:
case nir_intrinsic_store_per_vertex_output:
case nir_intrinsic_store_ssbo:
case nir_intrinsic_store_shared:
+ arg_index = 0;
break;
default:
return false;
}
- if (!intrin->src[0].is_ssa ||
- intrin->src[0].ssa->parent_instr->type != nir_instr_type_ssa_undef)
+ if (!intrin->src[arg_index].is_ssa ||
+ intrin->src[arg_index].ssa->parent_instr->type != nir_instr_type_ssa_undef)
return false;
nir_instr_remove(&intrin->instr);
@@ -133,8 +138,6 @@ 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);