intel/compiler: Use nir_dest_bit_size() for ballot bit size check
authorKenneth Graunke <kenneth@whitecape.org>
Sat, 8 Apr 2023 02:19:31 +0000 (19:19 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Sat, 8 Apr 2023 02:28:56 +0000 (19:28 -0700)
commit98bcf650f15f7d6b05b4fd7c6ecf20468e6aaea8
tree2cc6e16395175d02b90d4a38ef1424b83243a809
parentf5471ca9657b0abf7fef4bcb9a3d9fa848557635
intel/compiler: Use nir_dest_bit_size() for ballot bit size check

There's no guarantee that this is a SSA value.  Use the helper to handle
both SSA values and register correctly.  Otherwise we read trash when we
encounter a register and make bad decisions on types, possibly leading
to our destination being UQ typed when the VGRF is only 32-bit.

Fixes compilation with -Dintel-clc=enabled since 7f6491b76d51f35e7671
(nir: Combine if_uses with instruction uses) but the bug is much older
than that, circa 2017.  We were just getting lucky before.

Fixes: 069bf7c9078a ("i965/fs: Match destination type to size for ballot")
Reviewed-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22374>
src/intel/compiler/brw_fs_nir.cpp