Mesa (master): nir: Report progress properly in nir_lower_bool_to_*
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Aug 25 22:56:41 UTC 2020
Module: Mesa
Branch: master
Commit: 27e6117ee9f77ef40721f7757e181ddf93fc60dd
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=27e6117ee9f77ef40721f7757e181ddf93fc60dd
Author: Jason Ekstrand <jason at jlekstrand.net>
Date: Fri Aug 21 19:02:02 2020 -0500
nir: Report progress properly in nir_lower_bool_to_*
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 at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6435>
---
src/compiler/nir/nir_lower_bool_to_bitsize.c | 2 +-
src/compiler/nir/nir_lower_bool_to_float.c | 2 ++
src/compiler/nir/nir_lower_bool_to_int32.c | 2 ++
3 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/compiler/nir/nir_lower_bool_to_bitsize.c b/src/compiler/nir/nir_lower_bool_to_bitsize.c
index e7414fbf3d9..703819560cc 100644
--- a/src/compiler/nir/nir_lower_bool_to_bitsize.c
+++ b/src/compiler/nir/nir_lower_bool_to_bitsize.c
@@ -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:
diff --git a/src/compiler/nir/nir_lower_bool_to_float.c b/src/compiler/nir/nir_lower_bool_to_float.c
index 0dd69c958f9..32f2ca056b2 100644
--- a/src/compiler/nir/nir_lower_bool_to_float.c
+++ b/src/compiler/nir/nir_lower_bool_to_float.c
@@ -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;
diff --git a/src/compiler/nir/nir_lower_bool_to_int32.c b/src/compiler/nir/nir_lower_bool_to_int32.c
index 1ea8d12cb21..706f5d6ef8d 100644
--- a/src/compiler/nir/nir_lower_bool_to_int32.c
+++ b/src/compiler/nir/nir_lower_bool_to_int32.c
@@ -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;
More information about the mesa-commit
mailing list