From: Sven Verdoolaege Date: Fri, 2 Apr 2010 20:45:57 +0000 (+0200) Subject: isl_map_coalesce: avoid reconsidering pairs considered before on change X-Git-Tag: isl-0.03~280 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d84248b20502cef6c364b165860bddacb17202fb;p=platform%2Fupstream%2Fisl.git isl_map_coalesce: avoid reconsidering pairs considered before on change Before, whenever anything changed (two elements get fused or one element gets dropped), we would start all over from scratch. Pairs that were already considered before and that are not related to the change do not need to be reconsidered. We may still reconsider some pairs, even after this commit. In particular, if one element gets dropped, then we will still reconsider all combinations with the element that did not get dropped. --- diff --git a/isl_coalesce.c b/isl_coalesce.c index f5f637c..6234924 100644 --- a/isl_coalesce.c +++ b/isl_coalesce.c @@ -844,14 +844,15 @@ static struct isl_map *coalesce(struct isl_map *map, struct isl_tab **tabs) { int i, j; - for (i = 0; i < map->n - 1; ++i) + for (i = map->n - 2; i >= 0; --i) +restart: for (j = i + 1; j < map->n; ++j) { int changed; changed = coalesce_pair(map, i, j, tabs); if (changed < 0) goto error; if (changed) - return coalesce(map, tabs); + goto restart; } return map; error: