-/* Assumes divs have been ordered if keep_divs is set.
- */
-static void eliminate_var_using_equality(struct isl_basic_map *bmap,
- unsigned pos, isl_int *eq, int keep_divs, int *progress)
-{
- unsigned total;
- int k;
- int last_div;
-
- total = isl_basic_map_total_dim(bmap);
- last_div = isl_seq_last_non_zero(eq + 1 + isl_dim_total(bmap->dim),
- bmap->n_div);
- for (k = 0; k < bmap->n_eq; ++k) {
- if (bmap->eq[k] == eq)
- continue;
- if (isl_int_is_zero(bmap->eq[k][1+pos]))
- continue;
- if (progress)
- *progress = 1;
- isl_seq_elim(bmap->eq[k], eq, 1+pos, 1+total, NULL);
- }
-
- for (k = 0; k < bmap->n_ineq; ++k) {
- if (isl_int_is_zero(bmap->ineq[k][1+pos]))
- continue;
- if (progress)
- *progress = 1;
- isl_seq_elim(bmap->ineq[k], eq, 1+pos, 1+total, NULL);
- ISL_F_CLR(bmap, ISL_BASIC_MAP_NORMALIZED);
- }
-
- for (k = 0; k < bmap->n_div; ++k) {
- if (isl_int_is_zero(bmap->div[k][0]))
- continue;
- if (isl_int_is_zero(bmap->div[k][1+1+pos]))
- continue;
- if (progress)
- *progress = 1;
- /* We need to be careful about circular definitions,
- * so for now we just remove the definition of div k
- * if the equality contains any divs.
- * If keep_divs is set, then the divs have been ordered
- * and we can keep the definition as long as the result
- * is still ordered.
- */
- if (last_div == -1 || (keep_divs && last_div < k))
- isl_seq_elim(bmap->div[k]+1, eq,
- 1+pos, 1+total, &bmap->div[k][0]);
- else
- isl_seq_clr(bmap->div[k], 1 + total);
- ISL_F_CLR(bmap, ISL_BASIC_MAP_NORMALIZED);
- }
-}
-