mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 02:38:04 +02:00
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>
This commit is contained in:
parent
c5fbcab803
commit
9a225415e3
1 changed files with 2 additions and 0 deletions
|
|
@ -445,6 +445,8 @@ nir_type_convert(nir_builder *b,
|
|||
|
||||
nir_op opcode =
|
||||
nir_type_conversion_op(src_type, dest_type, nir_rounding_mode_undef);
|
||||
if (opcode == nir_op_mov)
|
||||
return src;
|
||||
|
||||
return nir_build_alu(b, opcode, src, NULL, NULL, NULL);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue