isl_ast_expr_from_aff: avoid extracting modulos with very large coefficients
When looking for opportunities for writing an fdiv_q in terms of a modulo,
we check the explicitly available constraints first. These constraints
may include bounds on integer variables to the maximal value of some
integer type. We do not want to use such constraints since the corresponding
modulo expression will include this large constant value.
With any luck, there is still another bound hidden in the constraints
that does not have such a large constant term.
For example, on the new test case, we would produce code like this
for (int c2 = 0; c2 < -((-n +
2147483648) % 32) + 32; c2 += 1)
for (int c3 = 0; c3 <= 31; c3 += 1)
S_1(((-n +
2147483648) % 32) + n + c2 - 32, c1 + c3);
because the upper bound on n is explicitly available in the constraints,
while the lower bound on n has been eliminated because it is implied
by other constraints. By rejecting the upper bound, the AST generator
is forced to look for a lower bound on n and in the end produces
for (int c2 = 0; c2 < n % 32; c2 += 1)
for (int c3 = 0; c3 <= 31; c3 += 1)
S_1(-((n - 1) % 32) + n + c2 - 1, c1 + c3);
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>