nir: Convert the if-test for num_inputs == 2 to an assertion
authorIan Romanick <ian.d.romanick@intel.com>
Wed, 15 Apr 2015 22:20:57 +0000 (15:20 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Thu, 16 Apr 2015 16:56:49 +0000 (09:56 -0700)
Suggested by Jason on a different patch after some comments /
questions by Ilia.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
Reviewed-by: Connor Abbott <cwabott0@gmail.com>
src/glsl/nir/nir_search.c

index 73a802be7056e0a51f01bc6940192e1b5b47014d..5ba016085fcecad311f0ba351ace4e72e27f2bcc 100644 (file)
@@ -218,8 +218,8 @@ match_expression(const nir_search_expression *expr, nir_alu_instr *instr,
    if (matched)
       return true;
 
-   if (nir_op_infos[instr->op].num_inputs == 2 &&
-       (nir_op_infos[instr->op].algebraic_properties & NIR_OP_IS_COMMUTATIVE)) {
+   if (nir_op_infos[instr->op].algebraic_properties & NIR_OP_IS_COMMUTATIVE) {
+      assert(nir_op_infos[instr->op].num_inputs == 2);
       if (!match_value(expr->srcs[0], instr, 1, num_components,
                        swizzle, state))
          return false;