From 704dca214e430aaeef1fbf7c0335d906e5fbd3b7 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Mon, 16 Jan 2012 16:21:49 +0100 Subject: [PATCH] isl_tab_track_bmap: make sure we have a unique copy of the basic map The basic map will be modified in place by isl_tab_add_ineq. Some callers were passing a unique copy to isl_tab_track_bmap already, but some others apparently were not. It's safer to just let isl_tab_track_bmap take care of this. Signed-off-by: Sven Verdoolaege --- isl_tab.c | 1 + isl_tab_pip.c | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/isl_tab.c b/isl_tab.c index 492be5c..8cb307e 100644 --- a/isl_tab.c +++ b/isl_tab.c @@ -3231,6 +3231,7 @@ error: int isl_tab_track_bmap(struct isl_tab *tab, __isl_take isl_basic_map *bmap) { + bmap = isl_basic_map_cow(bmap); if (!tab || !bmap) goto error; diff --git a/isl_tab_pip.c b/isl_tab_pip.c index 9759dcf..c864e03 100644 --- a/isl_tab_pip.c +++ b/isl_tab_pip.c @@ -2510,7 +2510,6 @@ static struct isl_tab *context_tab_for_lexmin(struct isl_basic_set *bset) { struct isl_tab *tab; - bset = isl_basic_set_cow(bset); if (!bset) return NULL; tab = tab_for_lexmin((struct isl_basic_map *)bset, NULL, 1, 0); @@ -2682,7 +2681,8 @@ static struct isl_vec *gbr_get_sample(struct isl_context_gbr *cgbr) cgbr->cone = isl_tab_from_recession_cone(bset, 0); if (!cgbr->cone) return NULL; - if (isl_tab_track_bset(cgbr->cone, isl_basic_set_dup(bset)) < 0) + if (isl_tab_track_bset(cgbr->cone, + isl_basic_set_copy(bset)) < 0) return NULL; } if (isl_tab_detect_implicit_equalities(cgbr->cone) < 0) @@ -3044,7 +3044,8 @@ static int context_gbr_detect_equalities(struct isl_context *context, cgbr->cone = isl_tab_from_recession_cone(bset, 0); if (!cgbr->cone) goto error; - if (isl_tab_track_bset(cgbr->cone, isl_basic_set_dup(bset)) < 0) + if (isl_tab_track_bset(cgbr->cone, + isl_basic_set_copy(bset)) < 0) goto error; } if (isl_tab_detect_implicit_equalities(cgbr->cone) < 0) @@ -3250,8 +3251,7 @@ static struct isl_context *isl_context_gbr_alloc(struct isl_basic_set *dom) cgbr->tab = isl_tab_init_samples(cgbr->tab); if (!cgbr->tab) goto error; - if (isl_tab_track_bset(cgbr->tab, - isl_basic_set_cow(isl_basic_set_copy(dom))) < 0) + if (isl_tab_track_bset(cgbr->tab, isl_basic_set_copy(dom)) < 0) goto error; check_gbr_integer_feasible(cgbr); -- 2.7.4