[Mesa-dev] [PATCH] nir: Convert the if-test for num_inputs == 2 to an assertion

Connor Abbott cwabbott0 at gmail.com
Wed Apr 15 18:20:11 PDT 2015


Reviewed-by: Connor Abbott <cwabott0 at gmail.com>

On Wed, Apr 15, 2015 at 9:18 PM, Ian Romanick <idr at freedesktop.org> wrote:
> From: Ian Romanick <ian.d.romanick at intel.com>
>
> Suggested by Jason on a different patch after some comments /
> questions by Ilia.
>
> Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
> Cc: Jason Ekstrand <jason.ekstrand at intel.com>
> ---
>  src/glsl/nir/nir_search.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/glsl/nir/nir_search.c b/src/glsl/nir/nir_search.c
> index 73a802b..5ba0160 100644
> --- a/src/glsl/nir/nir_search.c
> +++ b/src/glsl/nir/nir_search.c
> @@ -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;
> --
> 2.1.0
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list