[Mesa-dev] [PATCH v2 5/8] nir: add complex_loop bool to loop info
Jason Ekstrand
jason at jlekstrand.net
Fri Aug 17 20:17:22 UTC 2018
4 and 5 are
Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
On Mon, Jul 23, 2018 at 3:03 AM Timothy Arceri <tarceri at itsqueeze.com>
wrote:
> In order to be sure loop_terminator_list is an accurate
> representation of all the jumps in the loop we need to be sure we
> didn't encounter any other complex behaviour such as continues,
> nested breaks, etc during analysis.
>
> This will be used in the following patch.
> ---
> src/compiler/nir/nir.h | 6 ++++++
> src/compiler/nir/nir_loop_analyze.c | 8 ++++++--
> 2 files changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h
> index 3bfe7d7f7bf..336a2ca5ac4 100644
> --- a/src/compiler/nir/nir.h
> +++ b/src/compiler/nir/nir.h
> @@ -1745,6 +1745,12 @@ typedef struct {
> /* Unroll the loop regardless of its size */
> bool force_unroll;
>
> + /* Does the loop contain complex loop terminators, continues or other
> + * complex behaviours? If this is true we can't rely on
> + * loop_terminator_list to be complete or accurate.
> + */
> + bool complex_loop;
> +
> nir_loop_terminator *limiting_terminator;
>
> /* A list of loop_terminators terminating this loop. */
> diff --git a/src/compiler/nir/nir_loop_analyze.c
> b/src/compiler/nir/nir_loop_analyze.c
> index 5454b7691ba..9c3fd2f286f 100644
> --- a/src/compiler/nir/nir_loop_analyze.c
> +++ b/src/compiler/nir/nir_loop_analyze.c
> @@ -317,15 +317,19 @@ find_loop_terminators(loop_info_state *state)
> * not find a loop terminator, but there is a break-statement
> then
> * we should return false so that we do not try to find
> trip-count
> */
> - if (!nir_is_trivial_loop_if(nif, break_blk))
> + if (!nir_is_trivial_loop_if(nif, break_blk)) {
> + state->loop->info->complex_loop = true;
> return false;
> + }
>
> /* Continue if the if contained no jumps at all */
> if (!break_blk)
> continue;
>
> - if (nif->condition.ssa->parent_instr->type == nir_instr_type_phi)
> + if (nif->condition.ssa->parent_instr->type ==
> nir_instr_type_phi) {
> + state->loop->info->complex_loop = true;
> return false;
> + }
>
> nir_loop_terminator *terminator =
> rzalloc(state->loop->info, nir_loop_terminator);
> --
> 2.17.1
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180817/a0e4737b/attachment.html>
More information about the mesa-dev
mailing list