[Mesa-dev] [PATCH 2/6] nir/lower_alu_to_scalar: Return after lower_reduction

Kenneth Graunke kenneth at whitecape.org
Tue Sep 22 19:50:27 PDT 2015


On Tuesday, September 22, 2015 06:18:12 PM Jason Ekstrand wrote:
> We don't use any of the code after the switch and, as far as I can tell, it
> wouldn't work anyway.  The only reason this wasn't causing us problems is
> that it's all dead and DCE cleans it up.

Huh, really?  Right after that switch statement I see:

   if (instr->dest.dest.ssa.num_components == 1)
      return;

and reductions should always produce a single component, so this change
seems like it should do nothing.  It seems like a reasonable change
regardless...but...

> ---
>  src/glsl/nir/nir_lower_alu_to_scalar.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/glsl/nir/nir_lower_alu_to_scalar.c b/src/glsl/nir/nir_lower_alu_to_scalar.c
> index 5ef5ec2..84d4943 100644
> --- a/src/glsl/nir/nir_lower_alu_to_scalar.c
> +++ b/src/glsl/nir/nir_lower_alu_to_scalar.c
> @@ -86,7 +86,7 @@ lower_alu_instr_scalar(nir_alu_instr *instr, nir_builder *b)
>     case name##3: \
>     case name##4: \
>        lower_reduction(instr, chan, merge, b); \
> -      break;
> +      return;
>  
>     switch (instr->op) {
>     case nir_op_vec4:
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20150922/b652d80d/attachment.sig>


More information about the mesa-dev mailing list