nir/find_array_copies: Reject copies with mismatched lengths
authorAndrii Simiklit <andrii.simiklit@globallogic.com>
Wed, 7 Aug 2019 10:56:38 +0000 (13:56 +0300)
committerJason Ekstrand <jason@jlekstrand.net>
Wed, 14 Aug 2019 18:11:31 +0000 (18:11 +0000)
commitff2225cf88d8773c599277362306a4bcf4ba6b01
tree2fbc4f3fcb738309ee90090cbba6ab096498cf99
parentc4a4f3db5a4c8676798855e131c360cdf0e4a6bc
nir/find_array_copies: Reject copies with mismatched lengths

copy_deref for wildcard dereferences requires the same
arrays lengths otherwise it leads to a crash in optimizations
like 'nir_opt_copy_prop_vars' because these optimizations expect
'copy_deref' just for arrays with the same lengths.

v2: check was moved to 'try_match_deref' to fix aoa cases
                 (Jason Ekstrand <jason@jlekstrand.net>)
v3: -fixed comment
    -the condition merged with other one
                 (Jason Ekstrand <jason@jlekstrand.net>)

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=111286
Signed-off-by: Andrii Simiklit <andrii.simiklit@globallogic.com>
src/compiler/nir/nir_opt_find_array_copies.c