nir: calculate trip count for more loops
authorTimothy Arceri <tarceri@itsqueeze.com>
Tue, 20 Nov 2018 02:45:58 +0000 (13:45 +1100)
committerTimothy Arceri <tarceri@itsqueeze.com>
Tue, 12 Mar 2019 00:52:30 +0000 (00:52 +0000)
commit68ce0ec22244726c1b61d91936a6b79ac20ab77a
tree4916d51a4433d6743c5ddeb5931fcd1a1bc1d214
parente8a8937a04fd9531069616c63c099ba276296112
nir: calculate trip count for more loops

This adds support to loop analysis for loops where the induction
variable is compared to the result of min(variable, constant).

For example:

   for (int i = 0; i < imin(x, 4); i++)
      ...

We add a new bool to the loop terminator struct in order to
differentiate terminators with this exit condition.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
src/compiler/nir/nir.h
src/compiler/nir/nir_loop_analyze.c
src/compiler/nir/nir_opt_loop_unroll.c