From: Jason Ekstrand Date: Wed, 25 Jul 2018 22:07:08 +0000 (-0700) Subject: nir/instr_set: Fix nir_instrs_equal for derefs X-Git-Tag: upstream/19.0.0~3514 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=05fb2f88ecf46809648230bcdd2c1563b317a188;p=platform%2Fupstream%2Fmesa.git nir/instr_set: Fix nir_instrs_equal for derefs We weren't returning at the end of the nir_isntr_type_deref case in nir_instrs_equal and it was falling through to the default of false. While we're at it, make the default unreachable because all statements in the switch now have their own returns. Had we done that before, we would have caught this bug a long time ago. Fixes: 19a4662a540a8c94 "nir: Add a deref instruction type" Reviewed-by: Caio Marcelo de Oliveira Filho Reviewed-by: Thomas Helland --- diff --git a/src/compiler/nir/nir_instr_set.c b/src/compiler/nir/nir_instr_set.c index 42aa618..19771fc 100644 --- a/src/compiler/nir/nir_instr_set.c +++ b/src/compiler/nir/nir_instr_set.c @@ -357,7 +357,7 @@ nir_instrs_equal(const nir_instr *instr1, const nir_instr *instr2) default: unreachable("Invalid instruction deref type"); } - break; + return true; } case nir_instr_type_tex: { nir_tex_instr *tex1 = nir_instr_as_tex(instr1); @@ -460,7 +460,7 @@ nir_instrs_equal(const nir_instr *instr1, const nir_instr *instr2) unreachable("Invalid instruction type"); } - return false; + unreachable("All cases in the above switch should return"); } static bool