nir/builder: Short-circuit in nir_type_convert if no conversion happens
authorJason Ekstrand <jason.ekstrand@collabora.com>
Tue, 29 Nov 2022 18:48:38 +0000 (12:48 -0600)
committerMarge Bot <emma+marge@anholt.net>
Thu, 1 Dec 2022 01:10:12 +0000 (01:10 +0000)
commit9a225415e334d77be687f4ad8e803f9e3748866f
tree59e8a8cbe94aa12d446369c1e9cd77397566e5fe
parentc5fbcab803399e4c77af3d45562b0b37fa82d80c
nir/builder: Short-circuit in nir_type_convert if no conversion happens

If both types are the same or both are integer types with the same bit
size, no actual conversion happens and nir_type_conversion_op() will
return nir_op_mov.  In this case, there's no point in emitting the move
and we can just return src instead.

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20067>
src/compiler/nir/nir_builder.c