-static void eliminate_var_using_equality(struct isl_basic_map *bmap,
- unsigned pos, isl_int *eq, int *progress)
-{
- unsigned total;
- int k;
- int contains_divs;
-
- total = isl_basic_map_total_dim(bmap);
- contains_divs =
- isl_seq_first_non_zero(eq + 1 + isl_dim_total(bmap->dim),
- bmap->n_div) != -1;
- 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 (contains_divs)
- isl_seq_clr(bmap->div[k], 1 + total);
- else
- isl_seq_elim(bmap->div[k]+1, eq,
- 1+pos, 1+total, &bmap->div[k][0]);
- ISL_F_CLR(bmap, ISL_BASIC_MAP_NORMALIZED);
- }
-}
-