nir/search_helpers: add has_multiple_uses helper

heuristic for the next patch.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Mel Henning <mhenning@darkrefraction.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35720>
This commit is contained in:
Alyssa Rosenzweig 2025-06-24 13:25:15 -04:00 committed by Marge Bot
parent 22272c71f2
commit 6efe557718

View file

@ -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)
{