summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorConnor Abbott <[email protected]>2019-07-31 11:32:30 +0200
committerConnor Abbott <[email protected]>2019-08-02 10:34:29 +0200
commitf41516bdb5720082702d8cb02f134d4da3f3a78c (patch)
tree6aac178110ea91466fb944455e7832ea84d41707
parent7368000868c21e72778d66b0cfd7661abfacfd00 (diff)
nir/find_array_copies: Reject copies with mismatched type
When we detect a scalar/vector copy through load_deref/store_deref, we have to be careful since those can bitcast an int to a float and vice-versa even though copy_deref can't. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=111251 Fixes: 156306e5e62 ("nir/find_array_copies: Handle wildcards and overlapping copies") Reviewed-by: Kenneth Graunke <[email protected]> Acked-by: Alyssa Rosenzweig <[email protected]>
-rw-r--r--src/compiler/nir/nir_opt_find_array_copies.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/compiler/nir/nir_opt_find_array_copies.c b/src/compiler/nir/nir_opt_find_array_copies.c
index 63609715c3a..b3fafe77375 100644
--- a/src/compiler/nir/nir_opt_find_array_copies.c
+++ b/src/compiler/nir/nir_opt_find_array_copies.c
@@ -541,13 +541,16 @@ opt_find_array_copies_block(nir_builder *b, nir_block *block,
/* There must be no indirects in the source or destination and no known
* out-of-bounds accesses in the source, and the copy must be fully
* qualified, or else we can't build up the array copy. We handled
- * out-of-bounds accesses to the dest above.
+ * out-of-bounds accesses to the dest above. The types must match, since
+ * copy_deref currently can't bitcast mismatched deref types.
*/
if (src_deref &&
(nir_deref_instr_has_indirect(src_deref) ||
nir_deref_instr_is_known_out_of_bounds(src_deref) ||
nir_deref_instr_has_indirect(dst_deref) ||
- !glsl_type_is_vector_or_scalar(src_deref->type))) {
+ !glsl_type_is_vector_or_scalar(src_deref->type) ||
+ glsl_get_bare_type(src_deref->type) !=
+ glsl_get_bare_type(dst_deref->type))) {
src_deref = NULL;
}