Module: Mesa
Branch: main
Commit: 4c3d138e5d28b391c45f75ad1e3073b8e054782b
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=4c3d138e5d28b391c45f75ad1e3073b8e054782b

Author: Timothy Arceri <[email protected]>
Date:   Mon May  9 18:20:34 2022 +1000

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 <[email protected]>
Reviewed-by: Jason Ekstrand <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16399>

---

 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;

Reply via email to