From 6efe557718de0fad44be9b432e1b77465211ac52 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Tue, 24 Jun 2025 13:25:15 -0400 Subject: [PATCH] nir/search_helpers: add has_multiple_uses helper heuristic for the next patch. Signed-off-by: Alyssa Rosenzweig Reviewed-by: Mel Henning Part-of: --- src/compiler/nir/nir_search_helpers.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/compiler/nir/nir_search_helpers.h b/src/compiler/nir/nir_search_helpers.h index 89a1642e0f0..9ad466b6c4b 100644 --- a/src/compiler/nir/nir_search_helpers.h +++ b/src/compiler/nir/nir_search_helpers.h @@ -498,6 +498,15 @@ is_not_const_and_not_fsign(struct hash_table *ht, const nir_alu_instr *instr, !is_fsign(instr, src, num_components, swizzle); } +static inline bool +has_multiple_uses(struct hash_table *ht, const nir_alu_instr *instr, + unsigned src, unsigned num_components, + const uint8_t *swizzle) +{ + return !list_is_empty(&instr->def.uses) && + !list_is_singular(&instr->def.uses); +} + static inline bool is_used_once(const nir_alu_instr *instr) {