nir/opt_deref: Fix the vector bitcast optimization

It assumes the parent is a vector or scalar so we need to fail if it
isn't.

Fixes: 9190f82d57 "nir/opt_deref: Add an optimization for bitcasts"
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7064>
This commit is contained in:
Jason Ekstrand
2020-10-08 09:57:14 -05:00
parent 54eae33558
commit 06a5edf247
2 changed files with 7 additions and 4 deletions

View File

@@ -358,7 +358,6 @@ program/execute/vload/vload-ulong-private: fail
program/execute/vload/vload-ushort-global: fail
program/execute/vload/vload-ushort-local: fail
program/execute/vload/vload-ushort-private: fail
program/execute/vload/vload_half-float-local: crash
program/execute/vload/vload_half-float-private: crash
program/execute/vload/vloada_half-float-private: crash
program/execute/vstore/vstore-char-global: fail
@@ -405,9 +404,9 @@ program/execute/vstore/vstorea_half-float-private: crash
summary:
name: results
---- --------
pass: 1418
pass: 1430
fail: 296
crash: 29
crash: 28
skip: 79
timeout: 0
warn: 0
@@ -417,4 +416,4 @@ summary:
changes: 0
fixes: 0
regressions: 0
total: 1822
total: 1833

View File

@@ -1123,6 +1123,10 @@ is_vector_bitcast_deref(nir_deref_instr *cast,
if (parent == NULL)
return false;
/* The parent has to be a vector or scalar */
if (!glsl_type_is_vector_or_scalar(parent->type))
return false;
/* Don't bother with 1-bit types */
unsigned cast_bit_size = glsl_get_bit_size(cast->type);
unsigned parent_bit_size = glsl_get_bit_size(parent->type);