[Mesa-dev] [PATCH 1/2] nir: fix if condition propagation for alu use

Jason Ekstrand jason at jlekstrand.net
Wed Oct 31 14:24:24 UTC 2018


Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>

Thanks for figuring this out.  This probably explains some of the hurt I
was seeing with my series as well.

--Jason

On Tue, Oct 30, 2018 at 9:17 PM Timothy Arceri <tarceri at itsqueeze.com>
wrote:

> From: Timothy Arceri <tarceri at localhost.localdomain>
>
> We need to update the cursor before we check if the alu use is
> dominated by the if condition. Previously we were checking if
> the current location of the alu instruction was dominated by
> the if condition which would miss some optimisation opportunities.
>
> Fixes: a3b4cb34589e ("nir/opt_if: Rework condition propagation")
> ---
>  src/compiler/nir/nir_opt_if.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/src/compiler/nir/nir_opt_if.c b/src/compiler/nir/nir_opt_if.c
> index 1f2e1f21130..1fe95e53766 100644
> --- a/src/compiler/nir/nir_opt_if.c
> +++ b/src/compiler/nir/nir_opt_if.c
> @@ -444,11 +444,10 @@ propagate_condition_eval(nir_builder *b, nir_if
> *nif, nir_src *use_src,
>                           bool is_if_condition)
>  {
>     bool bool_value;
> +   b->cursor = nir_before_src(alu_use, is_if_condition);
>     if (!evaluate_if_condition(nif, b->cursor, &bool_value))
>        return false;
>
> -   b->cursor = nir_before_src(alu_use, is_if_condition);
> -
>     nir_ssa_def *def[2] = {0};
>     for (unsigned i = 0; i < nir_op_infos[alu->op].num_inputs; i++) {
>        if (alu->src[i].src.ssa == use_src->ssa) {
> --
> 2.17.2
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20181031/dd831422/attachment.html>


More information about the mesa-dev mailing list