diff options
Diffstat (limited to 'src/compiler/nir/nir_search_helpers.h')
-rw-r--r-- | src/compiler/nir/nir_search_helpers.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/compiler/nir/nir_search_helpers.h b/src/compiler/nir/nir_search_helpers.h index 20fdae66e2c..ebb77ae67aa 100644 --- a/src/compiler/nir/nir_search_helpers.h +++ b/src/compiler/nir/nir_search_helpers.h @@ -114,4 +114,20 @@ is_zero_to_one(nir_alu_instr *instr, unsigned src, unsigned num_components, return true; } +static inline bool +is_used_more_than_once(nir_alu_instr *instr) +{ + bool zero_if_use = list_empty(&instr->dest.dest.ssa.if_uses); + bool zero_use = list_empty(&instr->dest.dest.ssa.uses); + + if (zero_use && zero_if_use) + return false; + else if (zero_use && list_is_singular(&instr->dest.dest.ssa.if_uses)) + return false; + else if (zero_if_use && list_is_singular(&instr->dest.dest.ssa.uses)) + return false; + + return true; +} + #endif /* _NIR_SEARCH_ */ |