nir/phis_to_scalar: Use a deny-list for load_deref modes

I can't think of any reason why shared and output aren't in this list.
The real thing we're trying to do is avoid premature scalarization
because of a shader or function temporary variable because we might
lower it to something we don't want scalarized later.  Also fix the
version we copy+pasted into GCM.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6332>
This commit is contained in:
Jason Ekstrand 2020-08-17 12:06:56 -05:00 committed by Marge Bot
parent 3f0a29fffb
commit 6b72004f12
2 changed files with 10 additions and 10 deletions

View file

@ -87,12 +87,12 @@ is_phi_src_scalarizable(nir_phi_src *src,
switch (src_intrin->intrinsic) {
case nir_intrinsic_load_deref: {
/* Don't scalarize if we see a load of a local variable because it
* might turn into one of the things we can't scalarize.
*/
nir_deref_instr *deref = nir_src_as_deref(src_intrin->src[0]);
return deref->mode == nir_var_shader_in ||
deref->mode == nir_var_uniform ||
deref->mode == nir_var_mem_ubo ||
deref->mode == nir_var_mem_ssbo ||
deref->mode == nir_var_mem_global;
return !(deref->mode & (nir_var_function_temp |
nir_var_shader_temp));
}
case nir_intrinsic_interp_deref_at_centroid:

View file

@ -142,12 +142,12 @@ is_src_scalarizable(nir_src *src)
switch (src_intrin->intrinsic) {
case nir_intrinsic_load_deref: {
/* Don't scalarize if we see a load of a local variable because it
* might turn into one of the things we can't scalarize.
*/
nir_deref_instr *deref = nir_src_as_deref(src_intrin->src[0]);
return deref->mode == nir_var_shader_in ||
deref->mode == nir_var_uniform ||
deref->mode == nir_var_mem_ubo ||
deref->mode == nir_var_mem_ssbo ||
deref->mode == nir_var_mem_global;
return !(deref->mode & (nir_var_function_temp |
nir_var_shader_temp));
}
case nir_intrinsic_interp_deref_at_centroid: