aboutsummaryrefslogtreecommitdiffstats
path: root/src/compiler/nir
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2018-04-02 16:10:04 -0700
committerJason Ekstrand <[email protected]>2018-06-22 20:54:00 -0700
commit378d7cf3ba2e2cee5c43464bb85f6ed8107aafda (patch)
treef089e7d23ab0ec8b77e4fe74575321ef68aaa888 /src/compiler/nir
parentc6a9c2b60b601659a8996e76976b5d7bbbed5a17 (diff)
nir: Remove deref chain support from propagate_invariant
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_propagate_invariant.c14
1 files changed, 3 insertions, 11 deletions
diff --git a/src/compiler/nir/nir_propagate_invariant.c b/src/compiler/nir/nir_propagate_invariant.c
index 63340c4ab68..9d17bdbc667 100644
--- a/src/compiler/nir/nir_propagate_invariant.c
+++ b/src/compiler/nir/nir_propagate_invariant.c
@@ -77,10 +77,7 @@ var_is_invariant(nir_variable *var, struct set * invariants)
static nir_variable *
intrinsic_get_var(nir_intrinsic_instr *intrin, unsigned i)
{
- if (nir_intrinsic_infos[intrin->intrinsic].num_variables == 0)
- return nir_deref_instr_get_variable(nir_src_as_deref(intrin->src[i]));
- else
- return intrin->variables[i]->var;
+ return nir_deref_instr_get_variable(nir_src_as_deref(intrin->src[i]));
}
static void
@@ -107,24 +104,17 @@ propagate_invariant_instr(nir_instr *instr, struct set *invariants)
case nir_instr_type_intrinsic: {
nir_intrinsic_instr *intrin = nir_instr_as_intrinsic(instr);
switch (intrin->intrinsic) {
- case nir_intrinsic_copy_var:
case nir_intrinsic_copy_deref:
/* If the destination is invariant then so is the source */
if (var_is_invariant(intrinsic_get_var(intrin, 0), invariants))
add_var(intrinsic_get_var(intrin, 1), invariants);
break;
- case nir_intrinsic_load_var:
case nir_intrinsic_load_deref:
if (dest_is_invariant(&intrin->dest, invariants))
add_var(intrinsic_get_var(intrin, 0), invariants);
break;
- case nir_intrinsic_store_var:
- if (var_is_invariant(intrin->variables[0]->var, invariants))
- add_src(&intrin->src[0], invariants);
- break;
-
case nir_intrinsic_store_deref:
if (var_is_invariant(intrinsic_get_var(intrin, 0), invariants))
add_src(&intrin->src[1], invariants);
@@ -201,6 +191,8 @@ nir_propagate_invariant(nir_shader *shader)
struct set *invariants = _mesa_set_create(NULL, _mesa_hash_pointer,
_mesa_key_pointer_equal);
+ nir_assert_unlowered_derefs(shader, nir_lower_load_store_derefs);
+
bool progress = false;
nir_foreach_function(function, shader) {
if (function->impl && propagate_invariant_impl(function->impl, invariants))