[polly] r241247 - Update isl to isl-0.15-35-ga1e44f0

Tobias Grosser tobias at grosser.es
Thu Jul 2 00:59:22 PDT 2015


Author: grosser
Date: Thu Jul  2 02:59:21 2015
New Revision: 241247

URL: http://llvm.org/viewvc/llvm-project?rev=241247&view=rev
Log:
Update isl to isl-0.15-35-ga1e44f0

This fixes a memory leak with in the sioimath backend.

Modified:
    polly/trunk/lib/External/isl/GIT_HEAD_ID
    polly/trunk/lib/External/isl/isl_ast_codegen.c
    polly/trunk/lib/External/isl/isl_ast_graft.c
    polly/trunk/lib/External/isl/isl_tab.c
    polly/trunk/lib/External/isl/test_inputs/codegen/isolate2.c

Modified: polly/trunk/lib/External/isl/GIT_HEAD_ID
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/External/isl/GIT_HEAD_ID?rev=241247&r1=241246&r2=241247&view=diff
==============================================================================
--- polly/trunk/lib/External/isl/GIT_HEAD_ID (original)
+++ polly/trunk/lib/External/isl/GIT_HEAD_ID Thu Jul  2 02:59:21 2015
@@ -1 +1 @@
-isl-0.15-30-g3518765
+isl-0.15-35-ga1e44f0

Modified: polly/trunk/lib/External/isl/isl_ast_codegen.c
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/External/isl/isl_ast_codegen.c?rev=241247&r1=241246&r2=241247&view=diff
==============================================================================
--- polly/trunk/lib/External/isl/isl_ast_codegen.c (original)
+++ polly/trunk/lib/External/isl/isl_ast_codegen.c Thu Jul  2 02:59:21 2015
@@ -2555,10 +2555,11 @@ static int foreach_iteration(__isl_take
 	int (*fn)(__isl_take isl_basic_set *bset, void *user), void *user)
 {
 	int i, n;
+	int empty;
 	int depth;
 	isl_multi_aff *expansion;
 	isl_basic_map *bmap;
-	isl_aff *lower;
+	isl_aff *lower = NULL;
 	isl_ast_build *stride_build;
 
 	depth = isl_ast_build_get_depth(build);
@@ -2577,10 +2578,17 @@ static int foreach_iteration(__isl_take
 
 	bmap = isl_basic_map_from_multi_aff(expansion);
 
-	lower = find_unroll_lower_bound(build, domain, depth, bmap, &n);
-	if (!lower)
+	empty = isl_set_is_empty(domain);
+	if (empty < 0) {
 		n = -1;
-	else if (init && init(n, user) < 0)
+	} else if (empty) {
+		n = 0;
+	} else {
+		lower = find_unroll_lower_bound(build, domain, depth, bmap, &n);
+		if (!lower)
+			n = -1;
+	}
+	if (n >= 0 && init && init(n, user) < 0)
 		n = -1;
 	for (i = 0; i < n; ++i) {
 		isl_set *set;
@@ -3263,18 +3271,76 @@ error:
 	return NULL;
 }
 
+/* Extract out the disjunction imposed by "domain" on the outer
+ * schedule dimensions.
+ *
+ * In particular, remove all inner dimensions from "domain" (including
+ * the current dimension) and then remove the constraints that are shared
+ * by all disjuncts in the result.
+ */
+static __isl_give isl_set *extract_disjunction(__isl_take isl_set *domain,
+	__isl_keep isl_ast_build *build)
+{
+	isl_set *hull;
+	int depth, dim;
+
+	domain = isl_ast_build_specialize(build, domain);
+	depth = isl_ast_build_get_depth(build);
+	dim = isl_set_dim(domain, isl_dim_set);
+	domain = isl_set_eliminate(domain, isl_dim_set, depth, dim - depth);
+	domain = isl_set_remove_unknown_divs(domain);
+	hull = isl_set_copy(domain);
+	hull = isl_set_from_basic_set(isl_set_unshifted_simple_hull(hull));
+	domain = isl_set_gist(domain, hull);
+
+	return domain;
+}
+
+/* Add "guard" to the grafts in "list".
+ * "build" is the outer AST build, while "sub_build" includes "guard"
+ * in its generated domain.
+ *
+ * First combine the grafts into a single graft and then add the guard.
+ * If the list is empty, or if some error occurred, then simply return
+ * the list.
+ */
+static __isl_give isl_ast_graft_list *list_add_guard(
+	__isl_take isl_ast_graft_list *list, __isl_keep isl_set *guard,
+	__isl_keep isl_ast_build *build, __isl_keep isl_ast_build *sub_build)
+{
+	isl_ast_graft *graft;
+
+	list = isl_ast_graft_list_fuse(list, sub_build);
+
+	if (isl_ast_graft_list_n_ast_graft(list) != 1)
+		return list;
+
+	graft = isl_ast_graft_list_get_ast_graft(list, 0);
+	graft = isl_ast_graft_add_guard(graft, isl_set_copy(guard), build);
+	list = isl_ast_graft_list_set_ast_graft(list, 0, graft);
+
+	return list;
+}
+
 /* Generate code for a single component, after shifting (if any)
  * has been applied, in case the schedule was specified as a schedule tree.
  * In particular, do so for the specified subset of the schedule domain.
+ *
+ * If we are outside of the isolated part, then "domain" may include
+ * a disjunction.  Explicitly generate this disjunction at this point
+ * instead of relying on the disjunction getting hoisted back up
+ * to this level.
  */
 static __isl_give isl_ast_graft_list *generate_shifted_component_tree_part(
 	__isl_keep isl_union_map *executed, __isl_take isl_set *domain,
 	__isl_keep isl_ast_build *build, int isolated)
 {
 	isl_union_set *uset;
+	isl_ast_graft_list *list;
+	isl_ast_build *sub_build;
 	int empty;
 
-	uset = isl_union_set_from_set(domain);
+	uset = isl_union_set_from_set(isl_set_copy(domain));
 	executed = isl_union_map_copy(executed);
 	executed = isl_union_map_intersect_domain(executed, uset);
 	empty = isl_union_map_is_empty(executed);
@@ -3283,14 +3349,27 @@ static __isl_give isl_ast_graft_list *ge
 	if (empty) {
 		isl_ctx *ctx;
 		isl_union_map_free(executed);
+		isl_set_free(domain);
 		ctx = isl_ast_build_get_ctx(build);
 		return isl_ast_graft_list_alloc(ctx, 0);
 	}
 
-	build = isl_ast_build_copy(build);
-	return generate_shifted_component_tree_base(executed, build, isolated);
+	sub_build = isl_ast_build_copy(build);
+	if (!isolated) {
+		domain = extract_disjunction(domain, build);
+		sub_build = isl_ast_build_restrict_generated(sub_build,
+							isl_set_copy(domain));
+	}
+	list = generate_shifted_component_tree_base(executed,
+				isl_ast_build_copy(sub_build), isolated);
+	if (!isolated)
+		list = list_add_guard(list, domain, build, sub_build);
+	isl_ast_build_free(sub_build);
+	isl_set_free(domain);
+	return list;
 error:
 	isl_union_map_free(executed);
+	isl_set_free(domain);
 	return NULL;
 }
 
@@ -5080,6 +5159,7 @@ static __isl_give isl_ast_graft_list *bu
 	isl_set *set;
 
 	set = isl_ast_build_get_generated(build);
+	set = isl_set_from_basic_set(isl_set_simple_hull(set));
 	schedule_domain = isl_union_set_from_set(set);
 
 	extension = isl_schedule_node_extension_get_extension(node);

Modified: polly/trunk/lib/External/isl/isl_ast_graft.c
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/External/isl/isl_ast_graft.c?rev=241247&r1=241246&r2=241247&view=diff
==============================================================================
--- polly/trunk/lib/External/isl/isl_ast_graft.c (original)
+++ polly/trunk/lib/External/isl/isl_ast_graft.c Thu Jul  2 02:59:21 2015
@@ -719,7 +719,7 @@ static __isl_give isl_ast_node_list *ext
 /* Look for shared enforced constraints by all the elements in "list"
  * on outer loops (with respect to the current depth) and return the result.
  *
- * We assume that the number of children is at least one.
+ * If there are no elements in "list", then return the empty set.
  */
 __isl_give isl_basic_set *isl_ast_graft_list_extract_shared_enforced(
 	__isl_keep isl_ast_graft_list *list,
@@ -733,16 +733,11 @@ __isl_give isl_basic_set *isl_ast_graft_
 	if (!list)
 		return NULL;
 
-	n = isl_ast_graft_list_n_ast_graft(list);
-	if (n == 0)
-		isl_die(isl_ast_graft_list_get_ctx(list), isl_error_invalid,
-			"for node should have at least one child",
-			return NULL);
-
 	space = isl_ast_build_get_space(build, 1);
 	enforced = isl_basic_set_empty(space);
 
 	depth = isl_ast_build_get_depth(build);
+	n = isl_ast_graft_list_n_ast_graft(list);
 	for (i = 0; i < n; ++i) {
 		isl_ast_graft *graft;
 

Modified: polly/trunk/lib/External/isl/isl_tab.c
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/External/isl/isl_tab.c?rev=241247&r1=241246&r2=241247&view=diff
==============================================================================
--- polly/trunk/lib/External/isl/isl_tab.c (original)
+++ polly/trunk/lib/External/isl/isl_tab.c Thu Jul  2 02:59:21 2015
@@ -616,21 +616,21 @@ static int min_is_manifestly_unbounded(s
 	return 1;
 }
 
-static int row_cmp(struct isl_tab *tab, int r1, int r2, int c, isl_int t)
+static int row_cmp(struct isl_tab *tab, int r1, int r2, int c, isl_int *t)
 {
 	unsigned off = 2 + tab->M;
 
 	if (tab->M) {
 		int s;
-		isl_int_mul(t, tab->mat->row[r1][2], tab->mat->row[r2][off+c]);
-		isl_int_submul(t, tab->mat->row[r2][2], tab->mat->row[r1][off+c]);
-		s = isl_int_sgn(t);
+		isl_int_mul(*t, tab->mat->row[r1][2], tab->mat->row[r2][off+c]);
+		isl_int_submul(*t, tab->mat->row[r2][2], tab->mat->row[r1][off+c]);
+		s = isl_int_sgn(*t);
 		if (s)
 			return s;
 	}
-	isl_int_mul(t, tab->mat->row[r1][1], tab->mat->row[r2][off + c]);
-	isl_int_submul(t, tab->mat->row[r2][1], tab->mat->row[r1][off + c]);
-	return isl_int_sgn(t);
+	isl_int_mul(*t, tab->mat->row[r1][1], tab->mat->row[r2][off + c]);
+	isl_int_submul(*t, tab->mat->row[r2][1], tab->mat->row[r1][off + c]);
+	return isl_int_sgn(*t);
 }
 
 /* Given the index of a column "c", return the index of a row
@@ -673,7 +673,7 @@ static int pivot_row(struct isl_tab *tab
 			r = j;
 			continue;
 		}
-		tsgn = sgn * row_cmp(tab, r, j, c, t);
+		tsgn = sgn * row_cmp(tab, r, j, c, &t);
 		if (tsgn < 0 || (tsgn == 0 &&
 					    tab->row_var[j] < tab->row_var[r]))
 			r = j;

Modified: polly/trunk/lib/External/isl/test_inputs/codegen/isolate2.c
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/External/isl/test_inputs/codegen/isolate2.c?rev=241247&r1=241246&r2=241247&view=diff
==============================================================================
--- polly/trunk/lib/External/isl/test_inputs/codegen/isolate2.c (original)
+++ polly/trunk/lib/External/isl/test_inputs/codegen/isolate2.c Thu Jul  2 02:59:21 2015
@@ -2,10 +2,12 @@ for (int c0 = 0; c0 <= 99; c0 += 1) {
   if (c0 >= 4 && c0 <= 6) {
     for (int c1 = 0; c1 <= 99; c1 += 1)
       A(c0, c1);
-  } else if (c0 >= 7) {
-    for (int c1 = 0; c1 <= 99; c1 += 1)
-      A(c0, c1);
-  } else
-    for (int c1 = 0; c1 <= 99; c1 += 1)
-      A(c0, c1);
+  } else if (c0 >= 7 || c0 <= 3) {
+    if (c0 >= 7) {
+      for (int c1 = 0; c1 <= 99; c1 += 1)
+        A(c0, c1);
+    } else
+      for (int c1 = 0; c1 <= 99; c1 += 1)
+        A(c0, c1);
+  }
 }





More information about the llvm-commits mailing list