From f5471ca9657b0abf7fef4bcb9a3d9fa848557635 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Fri, 7 Apr 2023 17:50:09 -0400 Subject: [PATCH] nir/validate: Only walk uses once Ostensibly faster. Signed-off-by: Alyssa Rosenzweig Reviewed-by: Faith Ekstrand Part-of: --- src/compiler/nir/nir_validate.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/compiler/nir/nir_validate.c b/src/compiler/nir/nir_validate.c index f051b23..d343021a 100644 --- a/src/compiler/nir/nir_validate.c +++ b/src/compiler/nir/nir_validate.c @@ -528,16 +528,17 @@ validate_deref_instr(nir_deref_instr *instr, validate_state *state) */ validate_dest(&instr->dest, state, 0, 0); - /* Deref instructions as if conditions don't make sense because if - * conditions expect well-formed Booleans. If you want to compare with - * NULL, an explicit comparison operation should be used. - */ - validate_assert(state, !nir_ssa_def_used_by_if(&instr->dest.ssa)); - /* Certain modes cannot be used as sources for phi instructions because * way too many passes assume that they can always chase deref chains. */ - nir_foreach_use(use, &instr->dest.ssa) { + nir_foreach_use_including_if(use, &instr->dest.ssa) { + /* Deref instructions as if conditions don't make sense because if + * conditions expect well-formed Booleans. If you want to compare with + * NULL, an explicit comparison operation should be used. + */ + if (!validate_assert(state, !use->is_if)) + continue; + if (use->parent_instr->type == nir_instr_type_phi) { validate_assert(state, !(instr->modes & (nir_var_shader_in | nir_var_shader_out | -- 2.7.4