nir: Report progress properly in nir_lower_bool_to_*
authorJason Ekstrand <jason@jlekstrand.net>
Sat, 22 Aug 2020 00:02:02 +0000 (19:02 -0500)
committerMarge Bot <eric+marge@anholt.net>
Tue, 25 Aug 2020 22:39:08 +0000 (22:39 +0000)
All three passes have the same bug where, in the mov/vec case they
unconditionally return true even if they don't change anything.  Throw
in a bit size check so they return false properly.

Reviewed-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6435>

src/compiler/nir/nir_lower_bool_to_bitsize.c
src/compiler/nir/nir_lower_bool_to_float.c
src/compiler/nir/nir_lower_bool_to_int32.c

index e7414fbf3d98c90d86c2140a007559caa1e3c537..703819560ccaa8ab3bf784f49957fa423bc87705 100644 (file)
@@ -110,7 +110,7 @@ lower_alu_instr(nir_builder *b, nir_alu_instr *alu)
    case nir_op_ior:
    case nir_op_ixor:
       if (nir_dest_bit_size(alu->dest.dest) > 1)
-         break; /* Not a boolean instruction */
+         return false; /* Not a boolean instruction */
       /* Fallthrough */
 
    case nir_op_ball_fequal2:
index 0dd69c958f9a6b6f2e6e47cff7fa5cbda23138e6..32f2ca056b2d5d1e60fb0e65258b48bb617ed574 100644 (file)
@@ -58,6 +58,8 @@ lower_alu_instr(nir_builder *b, nir_alu_instr *alu)
    case nir_op_vec4:
    case nir_op_vec8:
    case nir_op_vec16:
+      if (alu->dest.dest.ssa.bit_size != 1)
+         return false;
       /* These we expect to have booleans but the opcode doesn't change */
       break;
 
index 1ea8d12cb210f26f72b2a6fc268decf8b28d40c0..706f5d6ef8d5d5b4dec349be07bdade1395de99a 100644 (file)
@@ -59,6 +59,8 @@ lower_alu_instr(nir_alu_instr *alu)
    case nir_op_iand:
    case nir_op_ior:
    case nir_op_ixor:
+      if (alu->dest.dest.ssa.bit_size != 1)
+         return false;
       /* These we expect to have booleans but the opcode doesn't change */
       break;