From b01f3cea7a7216100b0046fd3ac8a8a62fc25ced Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Sat, 30 Nov 2024 04:17:06 -0500 Subject: [PATCH] nir/opt_varyings: remove redundant conditions from a while loop Most of these conditions are repeated below with a continue statement. This just puts break at the end where all of them are false. Reviewed-by: Alyssa Rosenzweig Part-of: --- src/compiler/nir/nir_opt_varyings.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/compiler/nir/nir_opt_varyings.c b/src/compiler/nir/nir_opt_varyings.c index 8b930dd1e48..f4a46e4d820 100644 --- a/src/compiler/nir/nir_opt_varyings.c +++ b/src/compiler/nir/nir_opt_varyings.c @@ -4212,13 +4212,7 @@ fs_assign_slots(struct linkage_info *linkage, /* Skip indirectly-indexed scalar slots and slots incompatible * with the FS vec4 type. */ - while ((fs_vec4_type != FS_VEC4_TYPE_NONE && - assigned_fs_vec4_type[vec4_slot(slot_index)] != - FS_VEC4_TYPE_NONE && - assigned_fs_vec4_type[vec4_slot(slot_index)] != - fs_vec4_type) || - BITSET_TEST32(linkage->indirect_mask, slot_index) || - BITSET_TEST(assigned_mask, slot_index)) { + while (1) { /* If the FS vec4 type is incompatible. Move to the next vec4. */ if (fs_vec4_type != FS_VEC4_TYPE_NONE && assigned_fs_vec4_type[vec4_slot(slot_index)] != @@ -4244,7 +4238,11 @@ fs_assign_slots(struct linkage_info *linkage, /* This slot is already assigned (assigned_mask is set). Move to * the next one. */ - slot_index += slot_size; + if (BITSET_TEST(assigned_mask, slot_index)) { + slot_index += slot_size; + continue; + } + break; } /* Assign color channels in this order, starting