summaryrefslogtreecommitdiffstats
path: root/src/compiler
diff options
context:
space:
mode:
authorDave Airlie <[email protected]>2018-11-19 13:54:33 +1000
committerDave Airlie <[email protected]>2018-11-20 05:36:52 +1000
commitc8a35285f0c8bef8ae70e2eb6d63b3c5cd44f499 (patch)
tree7a5b31b3e1ac8e867568d64d1475183ac658e309 /src/compiler
parent760859cac219d9ea4d29f58351161ea8de0bcc44 (diff)
nir: handle shared pointers in lowering indirect derefs.
Check if the base ends up with no variable, and continue if we see that case outside the loop. Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/nir/nir_lower_indirect_derefs.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/compiler/nir/nir_lower_indirect_derefs.c b/src/compiler/nir/nir_lower_indirect_derefs.c
index 897a0620872..adcfaec219f 100644
--- a/src/compiler/nir/nir_lower_indirect_derefs.c
+++ b/src/compiler/nir/nir_lower_indirect_derefs.c
@@ -135,7 +135,7 @@ lower_indirect_derefs_block(nir_block *block, nir_builder *b,
/* Walk the deref chain back to the base and look for indirects */
bool has_indirect = false;
nir_deref_instr *base = deref;
- while (base->deref_type != nir_deref_type_var) {
+ while (base && base->deref_type != nir_deref_type_var) {
if (base->deref_type == nir_deref_type_array &&
!nir_src_is_const(base->arr.index))
has_indirect = true;
@@ -143,7 +143,7 @@ lower_indirect_derefs_block(nir_block *block, nir_builder *b,
base = nir_deref_instr_parent(base);
}
- if (!has_indirect)
+ if (!has_indirect || !base)
continue;
/* Only lower variables whose mode is in the mask, or compact