isl_basic_map_compute_divs: recursively remove parameter equalities
authorSven Verdoolaege <skimo@kotnet.org>
Tue, 19 Mar 2013 10:23:20 +0000 (11:23 +0100)
committerSven Verdoolaege <skimo@kotnet.org>
Tue, 19 Mar 2013 12:37:04 +0000 (13:37 +0100)
The removal of explicit equalities among the parameters may uncover
additional equalities.  If so, we now recurse in parameter_compute_divs
so that also these extra equalities are removed.
This will be important for the next commit where we will try to compress
the existentially quantified variables and this requires the absence
of equalities among the parameters.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
isl_map.c

index 6eb1a1a..7b4f80e 100644 (file)
--- a/isl_map.c
+++ b/isl_map.c
@@ -6414,6 +6414,11 @@ static int first_parameter_equality(__isl_keep isl_basic_set *bset)
  * among the parameters by performing a variable compression on
  * the parameters.  Afterward, an inverse transformation is performed
  * and the equalities among the parameters are inserted back in.
+ *
+ * The variable compression on the parameters may uncover additional
+ * equalities that were only implicit before.  We therefore check
+ * if there are any new parameter equalities in the result and
+ * if so recurse.
  */
 static struct isl_set *parameter_compute_divs(struct isl_basic_set *bset)
 {
@@ -6454,7 +6459,13 @@ static struct isl_set *parameter_compute_divs(struct isl_basic_set *bset)
        }
        bset = basic_set_parameter_preimage(bset, T);
 
-       set = isl_basic_set_lexmin(bset);
+       i = first_parameter_equality(bset);
+       if (!bset)
+               set = NULL;
+       else if (i == bset->n_eq)
+               set = isl_basic_set_lexmin(bset);
+       else
+               set = parameter_compute_divs(bset);
        set = set_parameter_preimage(set, T2);
        set = set_append_equalities(set, eq);
        return set;