{
assert(start < end);
if (start == end - 1) {
- nir_ssa_def *index = nir_imm_int(b, start);
emit_load_store_deref(b, orig_instr,
- nir_build_deref_array(b, parent, index),
+ nir_build_deref_array_imm(b, parent, start),
deref_arr + 1, dest, src);
} else {
int mid = start + (end - start) / 2;
/* 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;
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
{
bool progress = false;
- if (modes == 0)
- return false;
-
nir_foreach_function(function, shader) {
if (function->impl)
progress = lower_indirects_impl(function->impl, modes) || progress;