isl_map_coalesce: harmonize integer divisions that differ by a constant
If an integer division in one basic map is equal to an integer division
in another basic map plus a constant, then it will not satisfy the
conditions of that other integer division and coalescing is going to fail.
By pulling out this constant difference, however, we may in some cases
be able to coalesce the two basic maps.
For example, in the case of the cholesky2 AST generation example,
at some stage during the generation, we have two basic maps
[M] -> { [i0, i1, i2, i3] : exists (e0 = floor((2 + i0)/3):
i1 = 1 and 3e0 = 2 + i0 and e0 >= 1 and e0 <= -2 + M) }
and
[M] -> { [i0, i1, i2, i3] : exists (e0 = floor((-1 + i0)/3):
i1 = 1 and 3e0 = -1 + i0 and e0 >= 0 and e0 <= -2 + M) }
which can not be directly coalesced.
Replacing e0 in the first basic map by e0' = e0 - 1, we find
[M] -> { [i0, i1, i2, i3] : exists (e0 = floor((-1 + i0)/3):
i1 = 1 and 3e0 = -1 + i0 and e0 >= 0 and e0 <= -3 + M) }
which can be coalesced with the second basic map.
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>