isl_ast_expr_from_constraint: detect stride constraints
commitfe6f19f1118598bd5e7a129cc125633fbba9883d
authorSven Verdoolaege <skimo@kotnet.org>
Mon, 11 Nov 2013 20:57:22 +0000 (11 21:57 +0100)
committerSven Verdoolaege <skimo@kotnet.org>
Sun, 26 Oct 2014 12:08:25 +0000 (26 13:08 +0100)
treefb966048c69a8ed821371fe85132fde4bb5d5d29
parent05677d3b35f35e2f364a999b3ab49307631fa104
isl_ast_expr_from_constraint: detect stride constraints

In particular, if an equality is of the form

    e - d floor(e/d) = 0

then directly convert it into

    e % d == 0

with '%' the isl_ast_op_zdiv_r operator.
Do this rather than the default procedure of
checking if (some variation of) e is non-negative and replacing
d floor(e/d) by e - (e mod d).

This saves some needless processing, but more importantly,
it allows us to detect stride conditions even when e cannot
be proven to be non-negative.

For example, we can now write

    if (n % 2 == 0)

instead of

    if (2 * floord(n, 2) == n)

even when nothing is known about n.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
isl_ast_build_expr.c
test_inputs/codegen/cloog/jacobi-shared.c
test_inputs/codegen/cloog/levenshtein-1-2-3.c
test_inputs/codegen/cloog/reservoir-liu-zhuge1.c
test_inputs/codegen/omega/guard1-0.c
test_inputs/codegen/omega/guard1-1.c
test_inputs/codegen/omega/iter9-0.c
test_inputs/codegen/separate2.c
test_inputs/codegen/shift2.c
test_inputs/codegen/stride5.c