X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=isl_tab.c;h=6089f3a101c26ec9a21e94f28fa20f496028429a;hb=db9e550ebf6ce5efa44b97e4b35a1d12086f94f7;hp=273d4b630f5a9e6eda95b151bb8266a059e310e2;hpb=8d08ef6dbc93594d3551b6a19037009a8a810062;p=platform%2Fupstream%2Fisl.git diff --git a/isl_tab.c b/isl_tab.c index 273d4b6..6089f3a 100644 --- a/isl_tab.c +++ b/isl_tab.c @@ -1,7 +1,7 @@ /* * Copyright 2008-2009 Katholieke Universiteit Leuven * - * Use of this software is governed by the GNU LGPLv2.1 license + * Use of this software is governed by the MIT license * * Written by Sven Verdoolaege, K.U.Leuven, Departement * Computerwetenschappen, Celestijnenlaan 200A, B-3001 Leuven, Belgium @@ -939,7 +939,7 @@ int isl_tab_mark_redundant(struct isl_tab *tab, int row) struct isl_tab_var *var = isl_tab_var_from_row(tab, row); var->is_redundant = 1; isl_assert(tab->mat->ctx, row >= tab->n_redundant, return -1); - if (tab->need_undo || tab->row_var[row] >= 0) { + if (tab->preserve || tab->need_undo || tab->row_var[row] >= 0) { if (tab->row_var[row] >= 0 && !var->is_nonneg) { var->is_nonneg = 1; if (isl_tab_push_var(tab, isl_tab_undo_nonneg, var) < 0) @@ -2199,7 +2199,13 @@ int isl_tab_add_div(struct isl_tab *tab, __isl_keep isl_vec *div, return r; } -struct isl_tab *isl_tab_from_basic_map(struct isl_basic_map *bmap) +/* If "track" is set, then we want to keep track of all constraints in tab + * in its bmap field. This field is initialized from a copy of "bmap", + * so we need to make sure that all constraints in "bmap" also appear + * in the constructed tab. + */ +__isl_give struct isl_tab *isl_tab_from_basic_map( + __isl_keep isl_basic_map *bmap, int track) { int i; struct isl_tab *tab; @@ -2211,11 +2217,12 @@ struct isl_tab *isl_tab_from_basic_map(struct isl_basic_map *bmap) isl_basic_map_total_dim(bmap), 0); if (!tab) return NULL; + tab->preserve = track; tab->rational = ISL_F_ISSET(bmap, ISL_BASIC_MAP_RATIONAL); if (ISL_F_ISSET(bmap, ISL_BASIC_MAP_EMPTY)) { if (isl_tab_mark_empty(tab) < 0) goto error; - return tab; + goto done; } for (i = 0; i < bmap->n_eq; ++i) { tab = add_eq(tab, bmap->eq[i]); @@ -2226,17 +2233,21 @@ struct isl_tab *isl_tab_from_basic_map(struct isl_basic_map *bmap) if (isl_tab_add_ineq(tab, bmap->ineq[i]) < 0) goto error; if (tab->empty) - return tab; + goto done; } +done: + if (track && isl_tab_track_bmap(tab, isl_basic_map_copy(bmap)) < 0) + goto error; return tab; error: isl_tab_free(tab); return NULL; } -struct isl_tab *isl_tab_from_basic_set(struct isl_basic_set *bset) +__isl_give struct isl_tab *isl_tab_from_basic_set( + __isl_keep isl_basic_set *bset, int track) { - return isl_tab_from_basic_map((struct isl_basic_map *)bset); + return isl_tab_from_basic_map(bset, track); } /* Construct a tableau corresponding to the recession cone of "bset". @@ -2545,6 +2556,13 @@ struct isl_tab *isl_tab_relax(struct isl_tab *tab, int con) var = &tab->con[con]; + if (var->is_row && (var->index < 0 || var->index < tab->n_redundant)) + isl_die(tab->mat->ctx, isl_error_invalid, + "cannot relax redundant constraint", goto error); + if (!var->is_row && (var->index < 0 || var->index < tab->n_dead)) + isl_die(tab->mat->ctx, isl_error_invalid, + "cannot relax dead constraint", goto error); + if (!var->is_row && !max_is_manifestly_unbounded(tab, var)) if (to_row(tab, var, 1) < 0) goto error;