[polly] r330800 - Update isl to isl-0.19-114-g385262af

Tobias Grosser via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 24 23:10:36 PDT 2018


Author: grosser
Date: Tue Apr 24 23:10:35 2018
New Revision: 330800

URL: http://llvm.org/viewvc/llvm-project?rev=330800&view=rev
Log:
Update isl to isl-0.19-114-g385262af

Modified:
    polly/trunk/lib/External/isl/AUTHORS
    polly/trunk/lib/External/isl/GIT_HEAD_ID
    polly/trunk/lib/External/isl/doc/user.pod
    polly/trunk/lib/External/isl/include/isl/aff.h
    polly/trunk/lib/External/isl/include/isl/map.h
    polly/trunk/lib/External/isl/include/isl/polynomial.h
    polly/trunk/lib/External/isl/include/isl/set.h
    polly/trunk/lib/External/isl/isl_aff.c
    polly/trunk/lib/External/isl/isl_aff_private.h
    polly/trunk/lib/External/isl/isl_map.c
    polly/trunk/lib/External/isl/isl_pw_templ.c
    polly/trunk/lib/External/isl/isl_space.c
    polly/trunk/lib/External/isl/isl_test.c

Modified: polly/trunk/lib/External/isl/AUTHORS
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/External/isl/AUTHORS?rev=330800&r1=330799&r2=330800&view=diff
==============================================================================
--- polly/trunk/lib/External/isl/AUTHORS (original)
+++ polly/trunk/lib/External/isl/AUTHORS Tue Apr 24 23:10:35 2018
@@ -42,7 +42,7 @@ Alexander Matz
 Sebastian Pop
 Louis-Noel Pouchet
 Benoit Pradelle
-Uday Kumar Reddy
+Uday Bondhugula
 Andreas Simbuerger
 Malhar Thakkar
 Sven van Haastregt

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=330800&r1=330799&r2=330800&view=diff
==============================================================================
--- polly/trunk/lib/External/isl/GIT_HEAD_ID (original)
+++ polly/trunk/lib/External/isl/GIT_HEAD_ID Tue Apr 24 23:10:35 2018
@@ -1 +1 @@
-isl-0.19-107-gc4fe33d8
+isl-0.19-114-g385262af

Modified: polly/trunk/lib/External/isl/doc/user.pod
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/External/isl/doc/user.pod?rev=330800&r1=330799&r2=330800&view=diff
==============================================================================
--- polly/trunk/lib/External/isl/doc/user.pod (original)
+++ polly/trunk/lib/External/isl/doc/user.pod Tue Apr 24 23:10:35 2018
@@ -4056,6 +4056,9 @@ the following functions can be used.
 	isl_bool isl_multi_aff_involves_dims(
 		__isl_keep isl_multi_aff *ma,
 		enum isl_dim_type type, unsigned first, unsigned n);
+	isl_bool isl_pw_multi_aff_involves_dims(
+		__isl_keep isl_pw_multi_aff *pma,
+		enum isl_dim_type type, unsigned first, unsigned n);
 	isl_bool isl_multi_pw_aff_involves_dims(
 		__isl_keep isl_multi_pw_aff *mpa,
 		enum isl_dim_type type, unsigned first, unsigned n);
@@ -5680,6 +5683,40 @@ All parameters need to be named.
 		__isl_take isl_qpolynomial *qp,
 		__isl_take isl_space *model);
 
+=item * Drop unused parameters
+
+Drop parameters that are not referenced by the isl object.
+All parameters need to be named.
+
+	#include <isl/set.h>
+	__isl_give isl_basic_set *
+	isl_basic_set_drop_unused_params(
+		__isl_take isl_basic_set *bset);
+	__isl_give isl_set *isl_set_drop_unused_params(
+		__isl_take isl_set *set);
+
+	#include <isl/map.h>
+	__isl_give isl_basic_map *
+	isl_basic_map_drop_unused_params(
+		__isl_take isl_basic_map *bmap);
+	__isl_give isl_map *isl_map_drop_unused_params(
+		__isl_take isl_map *map);
+
+	#include <isl/aff.h>
+	__isl_give isl_pw_aff *isl_pw_aff_drop_unused_params(
+		__isl_take isl_pw_aff *pa);
+	__isl_give isl_pw_multi_aff *
+	isl_pw_multi_aff_drop_unused_params(
+		__isl_take isl_pw_multi_aff *pma);
+
+	#include <isl/polynomial.h>
+	__isl_give isl_pw_qpolynomial *
+	isl_pw_qpolynomial_drop_unused_params(
+		__isl_take isl_pw_qpolynomial *pwqp);
+	__isl_give isl_pw_qpolynomial_fold *
+	isl_pw_qpolynomial_fold_drop_unused_params(
+		__isl_take isl_pw_qpolynomial_fold *pwf);
+
 =item * Unary Arithmetic Operations
 
 	#include <isl/set.h>

Modified: polly/trunk/lib/External/isl/include/isl/aff.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/External/isl/include/isl/aff.h?rev=330800&r1=330799&r2=330800&view=diff
==============================================================================
--- polly/trunk/lib/External/isl/include/isl/aff.h (original)
+++ polly/trunk/lib/External/isl/include/isl/aff.h Tue Apr 24 23:10:35 2018
@@ -246,6 +246,8 @@ __isl_give isl_pw_aff *isl_pw_aff_projec
 
 __isl_give isl_pw_aff *isl_pw_aff_align_params(__isl_take isl_pw_aff *pwaff,
 	__isl_take isl_space *model);
+__isl_give isl_pw_aff *isl_pw_aff_drop_unused_params(
+	__isl_take isl_pw_aff *pa);
 
 isl_bool isl_pw_aff_has_tuple_id(__isl_keep isl_pw_aff *pa,
 	enum isl_dim_type type);
@@ -486,6 +488,8 @@ __isl_null isl_pw_multi_aff *isl_pw_mult
 
 unsigned isl_pw_multi_aff_dim(__isl_keep isl_pw_multi_aff *pma,
 	enum isl_dim_type type);
+isl_bool isl_pw_multi_aff_involves_dims(__isl_keep isl_pw_multi_aff *pma,
+	enum isl_dim_type type, unsigned first, unsigned n);
 __isl_give isl_pw_aff *isl_pw_multi_aff_get_pw_aff(
 	__isl_keep isl_pw_multi_aff *pma, int pos);
 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_set_pw_aff(
@@ -600,6 +604,8 @@ __isl_give isl_pw_multi_aff *isl_pw_mult
 
 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_align_params(
 	__isl_take isl_pw_multi_aff *pma, __isl_take isl_space *model);
+__isl_give isl_pw_multi_aff *isl_pw_multi_aff_drop_unused_params(
+	__isl_take isl_pw_multi_aff *pma);
 
 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_coalesce(
 	__isl_take isl_pw_multi_aff *pma);

Modified: polly/trunk/lib/External/isl/include/isl/map.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/External/isl/include/isl/map.h?rev=330800&r1=330799&r2=330800&view=diff
==============================================================================
--- polly/trunk/lib/External/isl/include/isl/map.h (original)
+++ polly/trunk/lib/External/isl/include/isl/map.h Tue Apr 24 23:10:35 2018
@@ -642,6 +642,9 @@ __isl_give isl_basic_map *isl_basic_map_
 	__isl_take isl_basic_map *bmap, __isl_take isl_space *model);
 __isl_give isl_map *isl_map_align_params(__isl_take isl_map *map,
 	__isl_take isl_space *model);
+__isl_give isl_basic_map *isl_basic_map_drop_unused_params(
+	__isl_take isl_basic_map *bmap);
+__isl_give isl_map *isl_map_drop_unused_params(__isl_take isl_map *map);
 
 __isl_give isl_mat *isl_basic_map_equalities_matrix(
 		__isl_keep isl_basic_map *bmap, enum isl_dim_type c1,

Modified: polly/trunk/lib/External/isl/include/isl/polynomial.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/External/isl/include/isl/polynomial.h?rev=330800&r1=330799&r2=330800&view=diff
==============================================================================
--- polly/trunk/lib/External/isl/include/isl/polynomial.h (original)
+++ polly/trunk/lib/External/isl/include/isl/polynomial.h Tue Apr 24 23:10:35 2018
@@ -195,6 +195,9 @@ __isl_give isl_pw_qpolynomial *isl_pw_qp
 	__isl_take isl_pw_qpolynomial *pwqp,
 	enum isl_dim_type type, unsigned first, unsigned n);
 
+__isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_drop_unused_params(
+	__isl_take isl_pw_qpolynomial *pwqp);
+
 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_add(
 	__isl_take isl_pw_qpolynomial *pwqp1,
 	__isl_take isl_pw_qpolynomial *pwqp2);
@@ -423,6 +426,9 @@ __isl_give isl_pw_qpolynomial_fold *isl_
 	enum isl_dim_type dst_type, unsigned dst_pos,
 	enum isl_dim_type src_type, unsigned src_pos, unsigned n);
 
+__isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_drop_unused_params(
+	__isl_take isl_pw_qpolynomial_fold *pwf);
+
 __isl_give isl_val *isl_pw_qpolynomial_fold_eval(
 	__isl_take isl_pw_qpolynomial_fold *pwf, __isl_take isl_point *pnt);
 

Modified: polly/trunk/lib/External/isl/include/isl/set.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/External/isl/include/isl/set.h?rev=330800&r1=330799&r2=330800&view=diff
==============================================================================
--- polly/trunk/lib/External/isl/include/isl/set.h (original)
+++ polly/trunk/lib/External/isl/include/isl/set.h Tue Apr 24 23:10:35 2018
@@ -482,6 +482,9 @@ __isl_give isl_basic_set *isl_basic_set_
 	__isl_take isl_basic_set *bset, __isl_take isl_space *model);
 __isl_give isl_set *isl_set_align_params(__isl_take isl_set *set,
 	__isl_take isl_space *model);
+__isl_give isl_basic_set *isl_basic_set_drop_unused_params(
+	__isl_take isl_basic_set *bset);
+__isl_give isl_set *isl_set_drop_unused_params(__isl_take isl_set *set);
 
 __isl_give isl_mat *isl_basic_set_equalities_matrix(
 	__isl_keep isl_basic_set *bset, enum isl_dim_type c1,

Modified: polly/trunk/lib/External/isl/isl_aff.c
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/External/isl/isl_aff.c?rev=330800&r1=330799&r2=330800&view=diff
==============================================================================
--- polly/trunk/lib/External/isl/isl_aff.c (original)
+++ polly/trunk/lib/External/isl/isl_aff.c Tue Apr 24 23:10:35 2018
@@ -2716,10 +2716,9 @@ static __isl_give isl_set *align_params_
 		goto error;
 	if (equal_params)
 		return fn(pwaff1, pwaff2);
-	if (!isl_space_has_named_params(pwaff1->dim) ||
-	    !isl_space_has_named_params(pwaff2->dim))
-		isl_die(isl_pw_aff_get_ctx(pwaff1), isl_error_invalid,
-			"unaligned unnamed parameters", goto error);
+	if (isl_pw_aff_check_named_params(pwaff1) < 0 ||
+	    isl_pw_aff_check_named_params(pwaff2) < 0)
+		goto error;
 	pwaff1 = isl_pw_aff_align_params(pwaff1, isl_pw_aff_get_space(pwaff2));
 	pwaff2 = isl_pw_aff_align_params(pwaff2, isl_pw_aff_get_space(pwaff1));
 	return fn(pwaff1, pwaff2);
@@ -2746,10 +2745,9 @@ static __isl_give isl_map *align_params_
 		goto error;
 	if (equal_params)
 		return fn(pa1, pa2);
-	if (!isl_space_has_named_params(pa1->dim) ||
-	    !isl_space_has_named_params(pa2->dim))
-		isl_die(isl_pw_aff_get_ctx(pa1), isl_error_invalid,
-			"unaligned unnamed parameters", goto error);
+	if (isl_pw_aff_check_named_params(pa1) < 0 ||
+	    isl_pw_aff_check_named_params(pa2) < 0)
+		goto error;
 	pa1 = isl_pw_aff_align_params(pa1, isl_pw_aff_get_space(pa2));
 	pa2 = isl_pw_aff_align_params(pa2, isl_pw_aff_get_space(pa1));
 	return fn(pa1, pa2);
@@ -4287,7 +4285,6 @@ __isl_give isl_set *isl_multi_aff_lex_gt
 
 #define NO_SUB
 #define NO_OPT
-#define NO_INVOLVES_DIMS
 #define NO_INSERT_DIMS
 #define NO_LIFT
 #define NO_MORPH
@@ -6257,10 +6254,9 @@ __isl_give isl_pw_multi_aff *isl_pw_mult
 		goto error;
 	if (equal_params)
 		return pw_multi_aff_set_pw_aff(pma, pos, pa);
-	if (!isl_space_has_named_params(pma->dim) ||
-	    !isl_space_has_named_params(pa->dim))
-		isl_die(isl_pw_multi_aff_get_ctx(pma), isl_error_invalid,
-			"unaligned unnamed parameters", goto error);
+	if (isl_pw_multi_aff_check_named_params(pma) < 0 ||
+	    isl_pw_aff_check_named_params(pa) < 0)
+		goto error;
 	pma = isl_pw_multi_aff_align_params(pma, isl_pw_aff_get_space(pa));
 	pa = isl_pw_aff_align_params(pa, isl_pw_multi_aff_get_space(pma));
 	return pw_multi_aff_set_pw_aff(pma, pos, pa);

Modified: polly/trunk/lib/External/isl/isl_aff_private.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/External/isl/isl_aff_private.h?rev=330800&r1=330799&r2=330800&view=diff
==============================================================================
--- polly/trunk/lib/External/isl/isl_aff_private.h (original)
+++ polly/trunk/lib/External/isl/isl_aff_private.h Tue Apr 24 23:10:35 2018
@@ -162,6 +162,9 @@ __isl_give isl_pw_multi_aff *isl_pw_mult
 	__isl_take isl_pw_multi_aff *pma, enum isl_dim_type type, unsigned pos,
 	__isl_keep isl_pw_aff *subs);
 
+isl_stat isl_pw_aff_check_named_params(__isl_keep isl_pw_aff *pa);
+isl_stat isl_pw_multi_aff_check_named_params(__isl_keep isl_pw_multi_aff *pma);
+
 isl_bool isl_pw_aff_matching_params(__isl_keep isl_pw_aff *pa,
 	__isl_keep isl_space *space);
 isl_stat isl_pw_aff_check_match_domain_space(__isl_keep isl_pw_aff *pa,

Modified: polly/trunk/lib/External/isl/isl_map.c
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/External/isl/isl_map.c?rev=330800&r1=330799&r2=330800&view=diff
==============================================================================
--- polly/trunk/lib/External/isl/isl_map.c (original)
+++ polly/trunk/lib/External/isl/isl_map.c Tue Apr 24 23:10:35 2018
@@ -1349,6 +1349,14 @@ isl_stat isl_map_check_named_params(__is
 	return isl_space_check_named_params(isl_map_peek_space(map));
 }
 
+/* Check that "bmap" has only named parameters, reporting an error
+ * if it does not.
+ */
+static isl_stat isl_basic_map_check_named_params(__isl_keep isl_basic_map *bmap)
+{
+	return isl_space_check_named_params(isl_basic_map_peek_space(bmap));
+}
+
 /* Check that "bmap1" and "bmap2" have the same parameters,
  * reporting an error if they do not.
  */
@@ -11760,9 +11768,8 @@ __isl_give isl_basic_map *isl_basic_map_
 	if (!isl_space_has_named_params(model))
 		isl_die(ctx, isl_error_invalid,
 			"model has unnamed parameters", goto error);
-	if (!isl_space_has_named_params(bmap->dim))
-		isl_die(ctx, isl_error_invalid,
-			"relation has unnamed parameters", goto error);
+	if (isl_basic_map_check_named_params(bmap) < 0)
+		goto error;
 	equal_params = isl_space_has_equal_params(bmap->dim, model);
 	if (equal_params < 0)
 		goto error;
@@ -11832,6 +11839,69 @@ __isl_give isl_basic_set *isl_basic_set_
 	return isl_basic_map_align_params(bset, model);
 }
 
+/* Drop all parameters not referenced by "map".
+ */
+__isl_give isl_map *isl_map_drop_unused_params(__isl_take isl_map *map)
+{
+	int i;
+
+	if (isl_map_check_named_params(map) < 0)
+		return isl_map_free(map);
+
+	for (i = isl_map_dim(map, isl_dim_param) - 1; i >= 0; i--) {
+		isl_bool involves;
+
+		involves = isl_map_involves_dims(map, isl_dim_param, i, 1);
+		if (involves < 0)
+			return isl_map_free(map);
+		if (!involves)
+			map = isl_map_project_out(map, isl_dim_param, i, 1);
+	}
+
+	return map;
+}
+
+/* Drop all parameters not referenced by "set".
+ */
+__isl_give isl_set *isl_set_drop_unused_params(
+	__isl_take isl_set *set)
+{
+	return set_from_map(isl_map_drop_unused_params(set_to_map(set)));
+}
+
+/* Drop all parameters not referenced by "bmap".
+ */
+__isl_give isl_basic_map *isl_basic_map_drop_unused_params(
+	__isl_take isl_basic_map *bmap)
+{
+	int i;
+
+	if (isl_basic_map_check_named_params(bmap) < 0)
+		return isl_basic_map_free(bmap);
+
+	for (i = isl_basic_map_dim(bmap, isl_dim_param) - 1; i >= 0; i--) {
+		isl_bool involves;
+
+		involves = isl_basic_map_involves_dims(bmap,
+							isl_dim_param, i, 1);
+		if (involves < 0)
+			return isl_basic_map_free(bmap);
+		if (!involves)
+			bmap = isl_basic_map_drop(bmap, isl_dim_param, i, 1);
+	}
+
+	return bmap;
+}
+
+/* Drop all parameters not referenced by "bset".
+ */
+__isl_give isl_basic_set *isl_basic_set_drop_unused_params(
+	__isl_take isl_basic_set *bset)
+{
+	return bset_from_bmap(isl_basic_map_drop_unused_params(
+							bset_to_bmap(bset)));
+}
+
 __isl_give isl_mat *isl_basic_map_equalities_matrix(
 		__isl_keep isl_basic_map *bmap, enum isl_dim_type c1,
 		enum isl_dim_type c2, enum isl_dim_type c3,
@@ -13369,9 +13439,8 @@ __isl_give isl_map *isl_map_preimage_pw_
 
 	if (isl_map_check_named_params(map) < 0)
 		goto error;
-	if (!isl_space_has_named_params(pma->dim))
-		isl_die(map->ctx, isl_error_invalid,
-			"unaligned unnamed parameters", goto error);
+	if (isl_pw_multi_aff_check_named_params(pma) < 0)
+		goto error;
 	map = isl_map_align_params(map, isl_pw_multi_aff_get_space(pma));
 	pma = isl_pw_multi_aff_align_params(pma, isl_map_get_space(map));
 

Modified: polly/trunk/lib/External/isl/isl_pw_templ.c
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/External/isl/isl_pw_templ.c?rev=330800&r1=330799&r2=330800&view=diff
==============================================================================
--- polly/trunk/lib/External/isl/isl_pw_templ.c (original)
+++ polly/trunk/lib/External/isl/isl_pw_templ.c Tue Apr 24 23:10:35 2018
@@ -300,6 +300,14 @@ error:
 	return NULL;
 }
 
+/* Check that "pw" has only named parameters, reporting an error
+ * if it does not.
+ */
+isl_stat FN(PW,check_named_params)(__isl_keep PW *pw)
+{
+	return isl_space_check_named_params(FN(PW,peek_space)(pw));
+}
+
 /* Align the parameters of "pw" to those of "model".
  */
 __isl_give PW *FN(PW,align_params)(__isl_take PW *pw, __isl_take isl_space *model)
@@ -314,9 +322,8 @@ __isl_give PW *FN(PW,align_params)(__isl
 	if (!isl_space_has_named_params(model))
 		isl_die(ctx, isl_error_invalid,
 			"model has unnamed parameters", goto error);
-	if (!isl_space_has_named_params(pw->dim))
-		isl_die(ctx, isl_error_invalid,
-			"input has unnamed parameters", goto error);
+	if (FN(PW,check_named_params)(pw) < 0)
+		goto error;
 	equal_params = isl_space_has_equal_params(pw->dim, model);
 	if (equal_params < 0)
 		goto error;
@@ -356,10 +363,9 @@ static __isl_give PW *FN(PW,align_params
 	if (equal_params)
 		return fn(pw1, pw2);
 	ctx = FN(PW,get_ctx)(pw1);
-	if (!isl_space_has_named_params(pw1->dim) ||
-	    !isl_space_has_named_params(pw2->dim))
-		isl_die(ctx, isl_error_invalid,
-			"unaligned unnamed parameters", goto error);
+	if (FN(PW,check_named_params)(pw1) < 0 ||
+	    FN(PW,check_named_params)(pw2) < 0)
+		goto error;
 	pw1 = FN(PW,align_params)(pw1, FN(PW,get_space)(pw2));
 	pw2 = FN(PW,align_params)(pw2, FN(PW,get_space)(pw1));
 	return fn(pw1, pw2);
@@ -384,8 +390,9 @@ static __isl_give PW *FN(PW,align_params
 	if (aligned)
 		return fn(pw, set);
 	ctx = FN(PW,get_ctx)(pw);
-	if (!isl_space_has_named_params(pw->dim) ||
-	    !isl_space_has_named_params(set->dim))
+	if (FN(PW,check_named_params)(pw) < 0)
+		goto error;
+	if (!isl_space_has_named_params(set->dim))
 		isl_die(ctx, isl_error_invalid,
 			"unaligned unnamed parameters", goto error);
 	pw = FN(PW,align_params)(pw, isl_set_get_space(set));
@@ -1141,7 +1148,6 @@ isl_ctx *FN(PW,get_ctx)(__isl_keep PW *p
 	return pw ? isl_space_get_ctx(pw->dim) : NULL;
 }
 
-#ifndef NO_INVOLVES_DIMS
 isl_bool FN(PW,involves_dims)(__isl_keep PW *pw, enum isl_dim_type type,
 	unsigned first, unsigned n)
 {
@@ -1167,7 +1173,6 @@ isl_bool FN(PW,involves_dims)(__isl_keep
 	}
 	return isl_bool_false;
 }
-#endif
 
 __isl_give PW *FN(PW,set_dim_name)(__isl_take PW *pw,
 	enum isl_dim_type type, unsigned pos, const char *s)
@@ -1201,7 +1206,6 @@ error:
 	return NULL;
 }
 
-#ifndef NO_DROP_DIMS
 __isl_give PW *FN(PW,drop_dims)(__isl_take PW *pw,
 	enum isl_dim_type type, unsigned first, unsigned n)
 {
@@ -1292,7 +1296,28 @@ __isl_give PW *FN(PW,project_domain_on_p
 	pw = FN(PW,reset_domain_space)(pw, space);
 	return pw;
 }
-#endif
+
+/* Drop all parameters not referenced by "pw".
+ */
+__isl_give PW *FN(PW,drop_unused_params)(__isl_take PW *pw)
+{
+	int i;
+
+	if (FN(PW,check_named_params)(pw) < 0)
+		return FN(PW,free)(pw);
+
+	for (i = FN(PW,dim)(pw, isl_dim_param) - 1; i >= 0; i--) {
+		isl_bool involves;
+
+		involves = FN(PW,involves_dims)(pw, isl_dim_param, i, 1);
+		if (involves < 0)
+			return FN(PW,free)(pw);
+		if (!involves)
+			pw = FN(PW,drop_dims)(pw, isl_dim_param, i, 1);
+	}
+
+	return pw;
+}
 
 #ifndef NO_INSERT_DIMS
 __isl_give PW *FN(PW,insert_dims)(__isl_take PW *pw, enum isl_dim_type type,
@@ -2073,8 +2098,9 @@ static __isl_give PW *FN(PW,align_params
 		return fn(pw, ma);
 	}
 	ctx = FN(PW,get_ctx)(pw);
-	if (!isl_space_has_named_params(pw->dim) ||
-	    !isl_space_has_named_params(ma_space))
+	if (FN(PW,check_named_params)(pw) < 0)
+		goto error;
+	if (!isl_space_has_named_params(ma_space))
 		isl_die(ctx, isl_error_invalid,
 			"unaligned unnamed parameters", goto error);
 	pw = FN(PW,align_params)(pw, ma_space);
@@ -2107,10 +2133,9 @@ static __isl_give PW *FN(PW,align_params
 		return fn(pw, pma);
 	}
 	ctx = FN(PW,get_ctx)(pw);
-	if (!isl_space_has_named_params(pw->dim) ||
-	    !isl_space_has_named_params(pma_space))
-		isl_die(ctx, isl_error_invalid,
-			"unaligned unnamed parameters", goto error);
+	if (FN(PW,check_named_params)(pw) < 0 ||
+	    isl_pw_multi_aff_check_named_params(pma) < 0)
+		goto error;
 	pw = FN(PW,align_params)(pw, pma_space);
 	pma = isl_pw_multi_aff_align_params(pma, FN(PW,get_space)(pw));
 	return fn(pw, pma);

Modified: polly/trunk/lib/External/isl/isl_space.c
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/External/isl/isl_space.c?rev=330800&r1=330799&r2=330800&view=diff
==============================================================================
--- polly/trunk/lib/External/isl/isl_space.c (original)
+++ polly/trunk/lib/External/isl/isl_space.c Tue Apr 24 23:10:35 2018
@@ -2546,7 +2546,7 @@ isl_stat isl_space_check_named_params(__
 		return isl_stat_error;
 	if (!named)
 		isl_die(isl_space_get_ctx(space), isl_error_invalid,
-			"unaligned unnamed parameters", return isl_stat_error);
+			"unexpected unnamed parameters", return isl_stat_error);
 
 	return isl_stat_ok;
 }

Modified: polly/trunk/lib/External/isl/isl_test.c
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/External/isl/isl_test.c?rev=330800&r1=330799&r2=330800&view=diff
==============================================================================
--- polly/trunk/lib/External/isl/isl_test.c (original)
+++ polly/trunk/lib/External/isl/isl_test.c Tue Apr 24 23:10:35 2018
@@ -7168,6 +7168,64 @@ int test_align_parameters(isl_ctx *ctx)
 	return 0;
 }
 
+/* Check that isl_*_drop_unused_params actually drops the unused parameters
+ * by comparing the result using isl_*_plain_is_equal.
+ * Note that this assumes that isl_*_plain_is_equal does not consider
+ * objects that only differ by unused parameters to be equal.
+ */
+int test_drop_unused_parameters(isl_ctx *ctx)
+{
+	const char *str_with, *str_without;
+	isl_basic_set *bset1, *bset2;
+	isl_set *set1, *set2;
+	isl_pw_aff *pwa1, *pwa2;
+	int equal;
+
+	str_with = "[n, m, o] -> { [m] }";
+	str_without = "[m] -> { [m] }";
+
+	bset1 = isl_basic_set_read_from_str(ctx, str_with);
+	bset2 = isl_basic_set_read_from_str(ctx, str_without);
+	bset1 = isl_basic_set_drop_unused_params(bset1);
+	equal = isl_basic_set_plain_is_equal(bset1, bset2);
+	isl_basic_set_free(bset1);
+	isl_basic_set_free(bset2);
+
+	if (equal < 0)
+		return -1;
+	if (!equal)
+		isl_die(ctx, isl_error_unknown,
+			"result not as expected", return -1);
+
+	set1 = isl_set_read_from_str(ctx, str_with);
+	set2 = isl_set_read_from_str(ctx, str_without);
+	set1 = isl_set_drop_unused_params(set1);
+	equal = isl_set_plain_is_equal(set1, set2);
+	isl_set_free(set1);
+	isl_set_free(set2);
+
+	if (equal < 0)
+		return -1;
+	if (!equal)
+		isl_die(ctx, isl_error_unknown,
+			"result not as expected", return -1);
+
+	pwa1 = isl_pw_aff_read_from_str(ctx, str_with);
+	pwa2 = isl_pw_aff_read_from_str(ctx, str_without);
+	pwa1 = isl_pw_aff_drop_unused_params(pwa1);
+	equal = isl_pw_aff_plain_is_equal(pwa1, pwa2);
+	isl_pw_aff_free(pwa1);
+	isl_pw_aff_free(pwa2);
+
+	if (equal < 0)
+		return -1;
+	if (!equal)
+		isl_die(ctx, isl_error_unknown,
+			"result not as expected", return -1);
+
+	return 0;
+}
+
 static int test_list(isl_ctx *ctx)
 {
 	isl_id *a, *b, *c, *d, *id;
@@ -8908,6 +8966,7 @@ struct {
 	{ "conversion", &test_conversion },
 	{ "list", &test_list },
 	{ "align parameters", &test_align_parameters },
+	{ "drop unused parameters", &test_drop_unused_parameters },
 	{ "preimage", &test_preimage },
 	{ "pullback", &test_pullback },
 	{ "AST", &test_ast },




More information about the llvm-commits mailing list