From 427558a7178c704fd3102dc941d76316d9ca49e9 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Fri, 4 Jan 2019 11:11:49 -0600 Subject: [PATCH] nir/validate: Don't allow derefs in if conditions Reviewed-by: Caio Marcelo de Oliveira Filho --- src/compiler/nir/nir_validate.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/compiler/nir/nir_validate.c b/src/compiler/nir/nir_validate.c index 9f8455d21cc..df1e7b33004 100644 --- a/src/compiler/nir/nir_validate.c +++ b/src/compiler/nir/nir_validate.c @@ -493,6 +493,12 @@ validate_deref_instr(nir_deref_instr *instr, validate_state *state) * pointers should be. */ 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, list_empty(&instr->dest.ssa.if_uses)); } static void -- 2.30.2