isl_basic_map_simplify: reduce coefficients of integer divisions
Commit
3fbc27f (isl_aff_floor: reduce coefficients of newly created div,
Sun Jul 31 12:57:01 2011 +0200) introduced a reduction on the coefficients
of integer divisions created through isl_aff_floor.
Since this function is used during the parsing of set descriptions,
this means that an input of the form
{ [a, b] : 0 <= a <= 1 and ((b >= 0 and 2*floor((a + b)/2) >= -5 + a + 2b) or
(2*floor((-a + b)/2) >= -5 + a + 2b and 2*floor((-a + b)/2) < -a + 2b)) }
is transformed to
{ [a, b] : 0 <= a <= 1 and ((b >= 0 and 2*floor((a + b)/2) >= -5 + a + 2b) or
(2*floor((a + b)/2) >= -5 + 3a + 2b and 2*floor((a + b)/2) < a + 2b)) }
resulting in identical integer divisions in the two disjuncts.
However, if the input is specified as
{ [a, b] : exists (e0: 0 <= a <= 1 and b >= 0 and
2e0 >= -5 + a + 2b and 2e0 >= -1 + a + b and 2e0 <= a + b);
[a, b] : exists (e0: 0 <= a <= 1 and 2e0 >= -5 + a + 2b and
2e0 >= -1 - a + b and 2e0 <= -a + b and 2e0 < -a + 2b) }
then the integer divisions are detected internally resulting in
{ [a, b] : 0 <= a <= 1 and ((b >= 0 and 2*floor((a + b)/2) >= -5 + a + 2b) or
(2*floor((-a + b)/2) >= -5 + a + 2b and 2*floor((-a + b)/2) < -a + 2b)) }
i.e., with different integer divisions in the two disjuncts.
Apply the same reduction applied by isl_aff_floor in isl_basic_map_simplify.
Do this by extending the removal of integer coefficients introduced in
commit
c9fb3b7 (isl_basic_map_simplify: remove integer coefficients from
integer divisions, Wed Apr 29 16:35:19 2015 +0200). As in that commit,
it would be nice if the reduction could be applied only during
the introduction of the integer division, but there are several
places where an integer division may be introduced or modified.
This change has an effect on the AST generation output because
the representation of the integer divisions involved is changed.
This effect is not always positive, but at least the results
should be more consistent and less dependent on internal changes.
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>