aboutsummaryrefslogtreecommitdiffstats
path: root/src/compiler/nir/nir_opt_loop_unroll.c
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2018-11-20 13:45:58 +1100
committerTimothy Arceri <[email protected]>2019-03-12 00:52:30 +0000
commit68ce0ec22244726c1b61d91936a6b79ac20ab77a (patch)
tree4916d51a4433d6743c5ddeb5931fcd1a1bc1d214 /src/compiler/nir/nir_opt_loop_unroll.c
parente8a8937a04fd9531069616c63c099ba276296112 (diff)
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 <[email protected]>
Diffstat (limited to 'src/compiler/nir/nir_opt_loop_unroll.c')
-rw-r--r--src/compiler/nir/nir_opt_loop_unroll.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/compiler/nir/nir_opt_loop_unroll.c b/src/compiler/nir/nir_opt_loop_unroll.c
index c700e6704da..a5a5ca3deee 100644
--- a/src/compiler/nir/nir_opt_loop_unroll.c
+++ b/src/compiler/nir/nir_opt_loop_unroll.c
@@ -827,7 +827,8 @@ process_loops(nir_shader *sh, nir_cf_node *cf_node, bool *has_nested_loop_out)
} else {
/* Attempt to unroll loops with two terminators. */
unsigned num_lt = list_length(&loop->info->loop_terminator_list);
- if (num_lt == 2) {
+ if (num_lt == 2 &&
+ !loop->info->limiting_terminator->exact_trip_count_unknown) {
bool limiting_term_second = true;
nir_loop_terminator *terminator =
list_first_entry(&loop->info->loop_terminator_list,