isl_ast_build_expr.c: isl_ast_expr_add_term: allow stealing from constant term
In particular, if the argument of a floor may be negative itself, but
can be made non-negative by moving part of the constant term of
the expression in which the floor appears inside the floor argument,
then do so by the minimial required amount.
For example, in a context where c0 >= 0, the argument of the floord
expression in
2 * floord(c0 - 1, 3) + 2
may be negative, but by moving the constant (in this case completely)
into this argument, we can write
2 * ((c0 + 2) / 3)
instead.
The reason for only using part of the constant term of the containing
expression rather than any positive offset is to reduce the risk of
introducing overflows. For example, if we have an expression
floord(n,2) in a context where n >= -
2147483648, then we do not
want to shift the argument to make it positive.
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>