nir: calculate trip count for more loops
[mesa.git] / src / compiler / nir / nir_opt_loop_unroll.c
index c700e6704dad7c1b31ea756651520decc2f48df5..a5a5ca3deeec5583048fdac1be3228b57270af02 100644 (file)
@@ -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,