isl_ast_expr_from_aff: clear denominator before calling extract_modulos
commite1ac81f426b8ddc50f9df99a19186785b5385288
authorSven Verdoolaege <skimo@kotnet.org>
Wed, 3 Jul 2013 10:34:18 +0000 (3 12:34 +0200)
committerSven Verdoolaege <skimo@kotnet.org>
Fri, 5 Jul 2013 10:54:36 +0000 (5 12:54 +0200)
tree71b526cf0bdaac7a1d4f1a31439e4daf47aa28c4
parent8c19c91f6b3504922984ce8c4f0b43fab7d2a116
isl_ast_expr_from_aff: clear denominator before calling extract_modulos

extract_modulos essentially assumes that the denominator of the affine
expression is one.  In particular, it depends on the caller to divide
the extracted modulo expression by the denominator.
Moreover, in a544f6d (isl_ast_expr_from_*: use isl_val,
Tue May 28 15:18:53 2013 +0200), call to isl_aff_get_coefficient
(which extracts the numerator of the coefficient) was replaced
by a call to isl_aff_get_coefficient_val (which extracts the entire,
possibly rational, coefficient).

Rather than trying to extract the numerator from this coefficient,
which is tricky because it may have been reduced already, we impose
that the denominator is one.  The same commit already imposed that
condition on (most of) the body of isl_ast_expr_from_aff.  We now
simply do so before the call to extract_modulos.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
isl_ast_build_expr.c
test_inputs/codegen/separate2.c [new file with mode: 0644]
test_inputs/codegen/separate2.in [new file with mode: 0644]