isl_tab_detect_implicit_equalities: do not add extra constraints
commitf6767d73e1bc38d4760f81abd165c236a502d896
authorSven Verdoolaege <skimo@kotnet.org>
Thu, 14 Jul 2016 12:54:53 +0000 (14 14:54 +0200)
committerSven Verdoolaege <skimo@kotnet.org>
Thu, 14 Jul 2016 16:16:13 +0000 (14 18:16 +0200)
tree3e312c1abfc7b301185761b638f02e5cc038929a
parente498d9494a0b6fe404ea81c68424317a7a1f16ee
isl_tab_detect_implicit_equalities: do not add extra constraints

isl_tab_detect_implicit_equalities calls cut_to_hyperplane
to mark the implicit equality constraints it finds as equality constraints.
This function in turn introduces an extra constraint such that
it can call close_row on it.  However, after closing the row
(which marks the original variable as zero, possibly along with other
variables), the extra constraint is no longer required.
Remove it again after it has served its purpose.

Not introducing extra constraints is important for the use of
isl_tab_detect_implicit_equalities inside isl_map_coalesce.
In particular, if isl_tab_detect_implicit_equalities adds extra constraints,
then the number of the constraints in the basic map and tableau
representations is no longer the same.  This was not originally a problem,
as long as the initial constraints in the tableau still match all constraints
of the basic map.  However, since a130b58 (isl_map_coalesce: allow general
coalescing with expanded divs, Fri May 27 13:12:48 2016 +0200),
the tableau may get adjusted to additional constraints that were
added to the basic map and for these additional constraints to
have the same positions in both representations, the two should
have the same number of constraints to start with.
The extra constraints that could get added by
isl_tab_detect_implicit_equalities break this assumption and
caused a bug reported by Tobias Grosser.

Note that implicit equality constraints get detected internally at various
points inside isl.  It is therefore fairly unlikely to end up in a situation
where additional implicit equalities get detected from within
isl_map_coalesce.  The new test case circumvents the detection
of implicit equality constraints during parsing by explicitly calling
isl_basic_set_union, which currently happens to not perform this detection,
whereas the parsing of a combined input would end up calling
isl_set_union, which does perform the detection.

Reported-by: Tobias Grosser <tobias@grosser.es>
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
isl_tab.c
isl_test.c