nir: Handle call instructions in foreach_src

Even though they don't have regular sources, they do have derefs and
those may have implied sources that should be handled.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106980
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
(Unique to 18.1)
This commit is contained in:
Jason Ekstrand 2018-06-25 09:13:04 -07:00 committed by Dylan Baker
parent 915d9166bf
commit d96eecbdd7

View file

@ -1373,6 +1373,20 @@ visit_tex_src(nir_tex_instr *instr, nir_foreach_src_cb cb, void *state)
return true;
}
static bool
visit_call_src(nir_call_instr *instr, nir_foreach_src_cb cb, void *state)
{
if (instr->return_deref && !visit_deref_src(instr->return_deref, cb, state))
return false;
for (unsigned i = 0; i < instr->num_params; i++) {
if (!visit_deref_src(instr->params[i], cb, state))
return false;
}
return true;
}
static bool
visit_intrinsic_src(nir_intrinsic_instr *instr, nir_foreach_src_cb cb,
void *state)
@ -1449,7 +1463,8 @@ nir_foreach_src(nir_instr *instr, nir_foreach_src_cb cb, void *state)
return false;
break;
case nir_instr_type_call:
/* Call instructions have no regular sources */
if (!visit_call_src(nir_instr_as_call(instr), cb, state))
return false;
break;
case nir_instr_type_load_const:
/* Constant load instructions have no regular sources */