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:
@@ -1912,6 +1912,17 @@ typedef struct {
|
||||
bool continue_from_then;
|
||||
bool induction_rhs;
|
||||
|
||||
/* This is true if the terminators exact trip count is unknown. For
|
||||
* example:
|
||||
*
|
||||
* for (int i = 0; i < imin(x, 4); i++)
|
||||
* ...
|
||||
*
|
||||
* Here loop analysis would have set a max_trip_count of 4 however we dont
|
||||
* know for sure that this is the exact trip count.
|
||||
*/
|
||||
bool exact_trip_count_unknown;
|
||||
|
||||
struct list_head loop_terminator_link;
|
||||
} nir_loop_terminator;
|
||||
|
||||
|
Reference in New Issue
Block a user