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>
This commit is contained in:
@@ -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,
|
||||
|
Reference in New Issue
Block a user