When sort_divs encounters two identical that appear nested
inside some other div, it would simply drop one of the identical
divs, instead of summing the coefficients of both divs.
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
isl_seq_eq(qp->div->row[i - skip - 1],
qp->div->row[i - skip], qp->div->n_col)) {
qp->div = isl_mat_drop_rows(qp->div, i - skip, 1);
+ isl_mat_col_add(qp->div, 2 + div_pos + i - skip - 1,
+ 2 + div_pos + i - skip);
qp->div = isl_mat_drop_cols(qp->div,
2 + div_pos + i - skip, 1);
skip++;
isl_div_free(div);
+ qp = sort_divs(qp);
+
return qp;
error:
isl_qpolynomial_free(qp);
assert(isl_pw_qpolynomial_is_zero(pwqp1));
isl_pw_qpolynomial_free(pwqp1);
+
+ str = "{ [i] -> ([([i/2] + [i/2])/5]) }";
+ pwqp1 = isl_pw_qpolynomial_read_from_str(ctx, str);
+ str = "{ [i] -> ([(2 * [i/2])/5]) }";
+ pwqp2 = isl_pw_qpolynomial_read_from_str(ctx, str);
+
+ pwqp1 = isl_pw_qpolynomial_sub(pwqp1, pwqp2);
+
+ assert(isl_pw_qpolynomial_is_zero(pwqp1));
+
+ isl_pw_qpolynomial_free(pwqp1);
}
void test_split_periods(isl_ctx *ctx)