From 4c3d138e5d28b391c45f75ad1e3073b8e054782b Mon Sep 17 00:00:00 2001 From: Timothy Arceri Date: Mon, 9 May 2022 18:20:34 +1000 Subject: [PATCH] nir: always set the exact_trip_count_unknown loop terminator property Previously we only cared if this was set for the limiting terminator. However in the following patch we will make use of this information on other terminators to decide if we can eliminate them. Reviewed-by: Emma Anholt Reviewed-by: Jason Ekstrand Part-of: --- src/compiler/nir/nir_loop_analyze.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/compiler/nir/nir_loop_analyze.c b/src/compiler/nir/nir_loop_analyze.c index 2c6c1790822..c35a129d428 100644 --- a/src/compiler/nir/nir_loop_analyze.c +++ b/src/compiler/nir/nir_loop_analyze.c @@ -1072,6 +1072,7 @@ find_trip_count(loop_info_state *state, unsigned execution_mode) * nir_opt_dead_cf pass. */ trip_count_known = false; + terminator->exact_trip_count_unknown = true; continue; } @@ -1105,6 +1106,7 @@ find_trip_count(loop_info_state *state, unsigned execution_mode) */ if (!basic_ind.def) { trip_count_known = false; + terminator->exact_trip_count_unknown = true; continue; } @@ -1120,6 +1122,7 @@ find_trip_count(loop_info_state *state, unsigned execution_mode) if (!try_find_limit_of_alu(limit, &limit_val, terminator, state)) { /* Guess loop limit based on array access */ if (!guess_loop_limit(state, &limit_val, basic_ind)) { + terminator->exact_trip_count_unknown = true; continue; } @@ -1174,11 +1177,13 @@ find_trip_count(loop_info_state *state, unsigned execution_mode) if (iterations == -1) { trip_count_known = false; guessed_trip_count = false; + terminator->exact_trip_count_unknown = true; continue; } if (guessed_trip_count) { guessed_trip_count = false; + terminator->exact_trip_count_unknown = true; if (state->loop->info->guessed_trip_count == 0 || state->loop->info->guessed_trip_count > iterations) state->loop->info->guessed_trip_count = iterations;