summaryrefslogtreecommitdiff
path: root/isl_tab_pip.c
diff options
context:
space:
mode:
authorSven Verdoolaege <skimo@kotnet.org>2011-02-05 21:01:22 +0100
committerSven Verdoolaege <skimo@kotnet.org>2011-02-05 21:01:22 +0100
commitb9791ad473737122c50378d6d0eaff7f5e414234 (patch)
tree2bf12f4a2f641d64edb0ba07210c0b40b9e321c9 /isl_tab_pip.c
parent0d462e9fee37e2f7bbeaaacb12a001888fc2f735 (diff)
downloadisl-b9791ad473737122c50378d6d0eaff7f5e414234.tar.gz
isl-b9791ad473737122c50378d6d0eaff7f5e414234.tar.bz2
isl-b9791ad473737122c50378d6d0eaff7f5e414234.zip
isl_tab_pip.c: correctly detect non-negativity of divs in lexmin contexts
In particular, the variables used to encode the div in the context tableau is always non-negative, but the actual variable used in the main tableau may not be non-negative. Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
Diffstat (limited to 'isl_tab_pip.c')
-rw-r--r--isl_tab_pip.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/isl_tab_pip.c b/isl_tab_pip.c
index f9f700e4..421a49f6 100644
--- a/isl_tab_pip.c
+++ b/isl_tab_pip.c
@@ -2257,11 +2257,25 @@ static int context_lex_get_div(struct isl_context *context, struct isl_tab *tab,
return get_div(tab, context, div);
}
+/* Add a div specified by "div" to the context tableau and return
+ * 1 if the div is obviously non-negative.
+ * context_tab_add_div will always return 1, because all variables
+ * in a isl_context_lex tableau are non-negative.
+ * However, if we are using a big parameter in the context, then this only
+ * reflects the non-negativity of the variable used to _encode_ the
+ * div, i.e., div' = M + div, so we can't draw any conclusions.
+ */
static int context_lex_add_div(struct isl_context *context, struct isl_vec *div)
{
struct isl_context_lex *clex = (struct isl_context_lex *)context;
- return context_tab_add_div(clex->tab, div,
+ int nonneg;
+ nonneg = context_tab_add_div(clex->tab, div,
context_lex_add_ineq_wrap, context);
+ if (nonneg < 0)
+ return -1;
+ if (clex->tab->M)
+ return 0;
+ return nonneg;
}
static int context_lex_detect_equalities(struct isl_context *context,