In particular, if the constraints were sorted before
then they may no longer be sorted after normalizing some of them.
The removal of the corresponding flags is put inside scale_down_inequality.
The other caller of scale_down_inequality (eliminate_var_using_equality)
already modifies the same flags and continues to do so after this commit
to take into account the effect of the actual elimination.
This is needed in those cases where no scaling is being performed.
This is unlikely to have an effect in practice.
The normalization usually happens when the set is first created
(before the constraints are sorted) or after a call to Gaussian
elimination, which already results in the removal of the flags.
Signed-off-by: Sven Verdoolaege <sven@cerebras.net>
@@ -71,6 +71,9 @@ static void swap_inequality(__isl_keep isl_basic_map *bmap, int a, int b)
* are assumed to be multiples of "f".
*
* If the factor is 0 or 1, then no scaling needs to be performed.
+ *
+ * If scaling is performed then take into account that the constraint
+ * is modified.
*/
static __isl_give isl_basic_map *scale_down_inequality(
__isl_take isl_basic_map *bmap, int ineq, isl_int f, unsigned len)
@@ -84,6 +87,8 @@ static __isl_give isl_basic_map *scale_down_inequality(
isl_int_fdiv_q(bmap->ineq[ineq][0], bmap->ineq[ineq][0], f);
isl_seq_scale_down(bmap->ineq[ineq] + 1, bmap->ineq[ineq] + 1, f, len);
+ bmap = isl_basic_map_modify_inequality(bmap);
+
return bmap;
}