llvm-project/polly/lib/External/isl/isl_domain_factor_templ.c

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

68 lines
1.9 KiB
C
Raw Normal View History

[Polly] Update ISL to isl-0.22.1-87-gfee05a13. The primary motivation is to fix an assertion failure in isl_basic_map_alloc_equality: isl_assert(ctx, room_for_con(bmap, 1), return -1); Although the assertion does not occur anymore, I could not identify which of ISL's commits fixed it. Compared to the previous ISL version, Polly requires some changes for this update * Since ISL commit 20d3574 "perform parameter alignment by modifying both arguments to function" isl_*_gist_* and similar functions do not always align the paramter list anymore. This caused the parameter lists in JScop files to become out-of-sync. Since many regression tests use JScop files with a fixed parameter list and order, we explicitly call align_params to ensure a predictable parameter list. * ISL changed some return types to isl_size, a typedef of (signed) int. This caused some issues where the return type was unsigned int before: - No overload for std::max(unsigned,isl_size) - It cause additional 'mixed signed/unsigned comparison' warnings. Since they do not break compilation, and sizes larger than 2^31 were never supported, I am going to fix it separately. * With the change to isl_size, commit 57d547 "isl_*_list_size: return isl_size" also changed the return value in case of an error from 0 to -1. This caused undefined looping over isl_iterator since the 'end iterator' got index -1, never reached from the 'begin iterator' with index 0. * Some internal changes in ISL caused the number of operations to increase when determining access ranges to determine aliasing overlaps. In one test, this caused exceeding the default limit of 800000. The operations-limit was disabled for this test.
2020-02-11 04:51:33 +08:00
/*
* Copyright 2012 Ecole Normale Superieure
* Copyright 2017 Sven Verdoolaege
*
* Use of this software is governed by the MIT license
*
* Written by Sven Verdoolaege,
* Ecole Normale Superieure, 45 rue d'Ulm, 75230 Paris, France
*/
#define xFN(TYPE,NAME) TYPE ## _ ## NAME
#define FN(TYPE,NAME) xFN(TYPE,NAME)
/* Drop the "n" domain dimensions starting at "first" from "obj",
* after checking that they do not appear in the affine expression.
*/
static __isl_give TYPE *FN(TYPE,drop_domain)(__isl_take TYPE *obj,
unsigned first, unsigned n)
{
isl_bool involves;
involves = FN(TYPE,involves_dims)(obj, isl_dim_in, first, n);
if (involves < 0)
return FN(TYPE,free)(obj);
if (involves)
isl_die(FN(TYPE,get_ctx)(obj), isl_error_invalid,
"affine expression involves some of the domain dimensions",
return FN(TYPE,free)(obj));
return FN(TYPE,drop_dims)(obj, isl_dim_in, first, n);
}
/* Check that the domain of "obj" is a product.
*/
static isl_stat FN(TYPE,check_domain_product)(__isl_keep TYPE *obj)
{
isl_bool is_product;
is_product = FN(TYPE,domain_is_product)(obj);
if (is_product < 0)
return isl_stat_error;
if (!is_product)
isl_die(FN(TYPE,get_ctx)(obj), isl_error_invalid,
"domain is not a product", return isl_stat_error);
return isl_stat_ok;
}
/* Given an affine function with a domain of the form [A -> B] that
* does not depend on B, return the same function on domain A.
*/
__isl_give TYPE *FN(TYPE,domain_factor_domain)(__isl_take TYPE *obj)
{
isl_space *space;
isl_size n, n_in;
if (FN(TYPE,check_domain_product)(obj) < 0)
return FN(TYPE,free)(obj);
space = FN(TYPE,get_domain_space)(obj);
n = isl_space_dim(space, isl_dim_set);
space = isl_space_factor_domain(space);
n_in = isl_space_dim(space, isl_dim_set);
if (n < 0 || n_in < 0)
obj = FN(TYPE,free)(obj);
else
obj = FN(TYPE,drop_domain)(obj, n_in, n - n_in);
obj = FN(TYPE,reset_domain_space)(obj, space);
return obj;
}