/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/tools/polly/lib/External/isl/isl_tab_lexopt_templ.c
Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | * Copyright 2008-2009 Katholieke Universiteit Leuven |
3 | | * Copyright 2010 INRIA Saclay |
4 | | * Copyright 2011 Sven Verdoolaege |
5 | | * |
6 | | * Use of this software is governed by the MIT license |
7 | | * |
8 | | * Written by Sven Verdoolaege, K.U.Leuven, Departement |
9 | | * Computerwetenschappen, Celestijnenlaan 200A, B-3001 Leuven, Belgium |
10 | | * and INRIA Saclay - Ile-de-France, Parc Club Orsay Universite, |
11 | | * ZAC des vignes, 4 rue Jacques Monod, 91893 Orsay, France |
12 | | */ |
13 | | |
14 | 16.1k | #define xSF(TYPE,SUFFIX) TYPE ## SUFFIX |
15 | 16.1k | #define SF(TYPE,SUFFIX) xSF(TYPE,SUFFIX) |
16 | | |
17 | | /* Given a basic map with at least two parallel constraints (as found |
18 | | * by the function parallel_constraints), first look for more constraints |
19 | | * parallel to the two constraint and replace the found list of parallel |
20 | | * constraints by a single constraint with as "input" part the minimum |
21 | | * of the input parts of the list of constraints. Then, recursively call |
22 | | * basic_map_partial_lexopt (possibly finding more parallel constraints) |
23 | | * and plug in the definition of the minimum in the result. |
24 | | * |
25 | | * As in parallel_constraints, only inequality constraints that only |
26 | | * involve input variables that do not occur in any other inequality |
27 | | * constraints are considered. |
28 | | * |
29 | | * More specifically, given a set of constraints |
30 | | * |
31 | | * a x + b_i(p) >= 0 |
32 | | * |
33 | | * Replace this set by a single constraint |
34 | | * |
35 | | * a x + u >= 0 |
36 | | * |
37 | | * with u a new parameter with constraints |
38 | | * |
39 | | * u <= b_i(p) |
40 | | * |
41 | | * Any solution to the new system is also a solution for the original system |
42 | | * since |
43 | | * |
44 | | * a x >= -u >= -b_i(p) |
45 | | * |
46 | | * Moreover, m = min_i(b_i(p)) satisfies the constraints on u and can |
47 | | * therefore be plugged into the solution. |
48 | | */ |
49 | | static TYPE *SF(basic_map_partial_lexopt_symm,SUFFIX)( |
50 | | __isl_take isl_basic_map *bmap, __isl_take isl_basic_set *dom, |
51 | | __isl_give isl_set **empty, int max, int first, int second) |
52 | 238 | { |
53 | 238 | int i, n, k; |
54 | 238 | int *list = NULL; |
55 | 238 | unsigned n_in, n_out, n_div; |
56 | 238 | isl_ctx *ctx; |
57 | 238 | isl_vec *var = NULL; |
58 | 238 | isl_mat *cst = NULL; |
59 | 238 | isl_space *map_space, *set_space; |
60 | 238 | |
61 | 238 | map_space = isl_basic_map_get_space(bmap); |
62 | 238 | set_space = empty ? isl_basic_set_get_space(dom)6 : NULL; |
63 | 238 | |
64 | 238 | n_in = isl_basic_map_dim(bmap, isl_dim_param) + |
65 | 238 | isl_basic_map_dim(bmap, isl_dim_in); |
66 | 238 | n_out = isl_basic_map_dim(bmap, isl_dim_all) - n_in; |
67 | 238 | |
68 | 238 | ctx = isl_basic_map_get_ctx(bmap); |
69 | 238 | list = isl_alloc_array(ctx, int, bmap->n_ineq); |
70 | 238 | var = isl_vec_alloc(ctx, n_out); |
71 | 238 | if ((bmap->n_ineq && !list) || (n_out && !var)) |
72 | 0 | goto error; |
73 | 238 | |
74 | 238 | list[0] = first; |
75 | 238 | list[1] = second; |
76 | 238 | isl_seq_cpy(var->el, bmap->ineq[first] + 1 + n_in, n_out); |
77 | 462 | for (i = second + 1, n = 2; i < bmap->n_ineq; ++i224 ) { |
78 | 224 | if (isl_seq_eq(var->el, bmap->ineq[i] + 1 + n_in, n_out) && |
79 | 224 | all_single_occurrence(bmap, i, n_in)3 ) |
80 | 0 | list[n++] = i; |
81 | 224 | } |
82 | 238 | |
83 | 238 | cst = isl_mat_alloc(ctx, n, 1 + n_in); |
84 | 238 | if (!cst) |
85 | 0 | goto error; |
86 | 238 | |
87 | 714 | for (i = 0; 238 i < n; ++i476 ) |
88 | 476 | isl_seq_cpy(cst->row[i], bmap->ineq[list[i]], 1 + n_in); |
89 | 238 | |
90 | 238 | bmap = isl_basic_map_cow(bmap); |
91 | 238 | if (!bmap) |
92 | 0 | goto error; |
93 | 714 | for (i = n - 1; 238 i >= 0; --i476 ) |
94 | 476 | if (isl_basic_map_drop_inequality(bmap, list[i]) < 0) |
95 | 0 | goto error; |
96 | 238 | |
97 | 238 | bmap = isl_basic_map_add_dims(bmap, isl_dim_in, 1); |
98 | 238 | bmap = isl_basic_map_extend_constraints(bmap, 0, 1); |
99 | 238 | k = isl_basic_map_alloc_inequality(bmap); |
100 | 238 | if (k < 0) |
101 | 0 | goto error; |
102 | 238 | isl_seq_clr(bmap->ineq[k], 1 + n_in); |
103 | 238 | isl_int_set_si(bmap->ineq[k][1 + n_in], 1); |
104 | 238 | isl_seq_cpy(bmap->ineq[k] + 1 + n_in + 1, var->el, n_out); |
105 | 238 | bmap = isl_basic_map_finalize(bmap); |
106 | 238 | |
107 | 238 | n_div = isl_basic_set_dim(dom, isl_dim_div); |
108 | 238 | dom = isl_basic_set_add_dims(dom, isl_dim_set, 1); |
109 | 238 | dom = isl_basic_set_extend_constraints(dom, 0, n); |
110 | 714 | for (i = 0; i < n; ++i476 ) { |
111 | 476 | k = isl_basic_set_alloc_inequality(dom); |
112 | 476 | if (k < 0) |
113 | 0 | goto error; |
114 | 476 | isl_seq_cpy(dom->ineq[k], cst->row[i], 1 + n_in); |
115 | 476 | isl_int_set_si(dom->ineq[k][1 + n_in], -1); |
116 | 476 | isl_seq_clr(dom->ineq[k] + 1 + n_in + 1, n_div); |
117 | 476 | } |
118 | 238 | |
119 | 238 | isl_vec_free(var); |
120 | 238 | free(list); |
121 | 238 | |
122 | 238 | return SF(basic_map_partial_lexopt_symm_core,SUFFIX)(bmap, dom, empty, |
123 | 238 | max, cst, map_space, set_space); |
124 | 238 | error: |
125 | 0 | isl_space_free(map_space); |
126 | 0 | isl_space_free(set_space); |
127 | 0 | isl_mat_free(cst); |
128 | 0 | isl_vec_free(var); |
129 | 0 | free(list); |
130 | 0 | isl_basic_set_free(dom); |
131 | 0 | isl_basic_map_free(bmap); |
132 | 0 | return NULL; |
133 | 238 | } isl_tab_pip.c:basic_map_partial_lexopt_symm Line | Count | Source | 52 | 55 | { | 53 | 55 | int i, n, k; | 54 | 55 | int *list = NULL; | 55 | 55 | unsigned n_in, n_out, n_div; | 56 | 55 | isl_ctx *ctx; | 57 | 55 | isl_vec *var = NULL; | 58 | 55 | isl_mat *cst = NULL; | 59 | 55 | isl_space *map_space, *set_space; | 60 | 55 | | 61 | 55 | map_space = isl_basic_map_get_space(bmap); | 62 | 55 | set_space = empty ? isl_basic_set_get_space(dom)6 : NULL; | 63 | 55 | | 64 | 55 | n_in = isl_basic_map_dim(bmap, isl_dim_param) + | 65 | 55 | isl_basic_map_dim(bmap, isl_dim_in); | 66 | 55 | n_out = isl_basic_map_dim(bmap, isl_dim_all) - n_in; | 67 | 55 | | 68 | 55 | ctx = isl_basic_map_get_ctx(bmap); | 69 | 55 | list = isl_alloc_array(ctx, int, bmap->n_ineq); | 70 | 55 | var = isl_vec_alloc(ctx, n_out); | 71 | 55 | if ((bmap->n_ineq && !list) || (n_out && !var)) | 72 | 0 | goto error; | 73 | 55 | | 74 | 55 | list[0] = first; | 75 | 55 | list[1] = second; | 76 | 55 | isl_seq_cpy(var->el, bmap->ineq[first] + 1 + n_in, n_out); | 77 | 135 | for (i = second + 1, n = 2; i < bmap->n_ineq; ++i80 ) { | 78 | 80 | if (isl_seq_eq(var->el, bmap->ineq[i] + 1 + n_in, n_out) && | 79 | 80 | all_single_occurrence(bmap, i, n_in)0 ) | 80 | 0 | list[n++] = i; | 81 | 80 | } | 82 | 55 | | 83 | 55 | cst = isl_mat_alloc(ctx, n, 1 + n_in); | 84 | 55 | if (!cst) | 85 | 0 | goto error; | 86 | 55 | | 87 | 165 | for (i = 0; 55 i < n; ++i110 ) | 88 | 110 | isl_seq_cpy(cst->row[i], bmap->ineq[list[i]], 1 + n_in); | 89 | 55 | | 90 | 55 | bmap = isl_basic_map_cow(bmap); | 91 | 55 | if (!bmap) | 92 | 0 | goto error; | 93 | 165 | for (i = n - 1; 55 i >= 0; --i110 ) | 94 | 110 | if (isl_basic_map_drop_inequality(bmap, list[i]) < 0) | 95 | 0 | goto error; | 96 | 55 | | 97 | 55 | bmap = isl_basic_map_add_dims(bmap, isl_dim_in, 1); | 98 | 55 | bmap = isl_basic_map_extend_constraints(bmap, 0, 1); | 99 | 55 | k = isl_basic_map_alloc_inequality(bmap); | 100 | 55 | if (k < 0) | 101 | 0 | goto error; | 102 | 55 | isl_seq_clr(bmap->ineq[k], 1 + n_in); | 103 | 55 | isl_int_set_si(bmap->ineq[k][1 + n_in], 1); | 104 | 55 | isl_seq_cpy(bmap->ineq[k] + 1 + n_in + 1, var->el, n_out); | 105 | 55 | bmap = isl_basic_map_finalize(bmap); | 106 | 55 | | 107 | 55 | n_div = isl_basic_set_dim(dom, isl_dim_div); | 108 | 55 | dom = isl_basic_set_add_dims(dom, isl_dim_set, 1); | 109 | 55 | dom = isl_basic_set_extend_constraints(dom, 0, n); | 110 | 165 | for (i = 0; i < n; ++i110 ) { | 111 | 110 | k = isl_basic_set_alloc_inequality(dom); | 112 | 110 | if (k < 0) | 113 | 0 | goto error; | 114 | 110 | isl_seq_cpy(dom->ineq[k], cst->row[i], 1 + n_in); | 115 | 110 | isl_int_set_si(dom->ineq[k][1 + n_in], -1); | 116 | 110 | isl_seq_clr(dom->ineq[k] + 1 + n_in + 1, n_div); | 117 | 110 | } | 118 | 55 | | 119 | 55 | isl_vec_free(var); | 120 | 55 | free(list); | 121 | 55 | | 122 | 55 | return SF(basic_map_partial_lexopt_symm_core,SUFFIX)(bmap, dom, empty, | 123 | 55 | max, cst, map_space, set_space); | 124 | 55 | error: | 125 | 0 | isl_space_free(map_space); | 126 | 0 | isl_space_free(set_space); | 127 | 0 | isl_mat_free(cst); | 128 | 0 | isl_vec_free(var); | 129 | 0 | free(list); | 130 | 0 | isl_basic_set_free(dom); | 131 | 0 | isl_basic_map_free(bmap); | 132 | 0 | return NULL; | 133 | 55 | } |
isl_tab_pip.c:basic_map_partial_lexopt_symm_pw_multi_aff Line | Count | Source | 52 | 183 | { | 53 | 183 | int i, n, k; | 54 | 183 | int *list = NULL; | 55 | 183 | unsigned n_in, n_out, n_div; | 56 | 183 | isl_ctx *ctx; | 57 | 183 | isl_vec *var = NULL; | 58 | 183 | isl_mat *cst = NULL; | 59 | 183 | isl_space *map_space, *set_space; | 60 | 183 | | 61 | 183 | map_space = isl_basic_map_get_space(bmap); | 62 | 183 | set_space = empty ? isl_basic_set_get_space(dom)0 : NULL; | 63 | 183 | | 64 | 183 | n_in = isl_basic_map_dim(bmap, isl_dim_param) + | 65 | 183 | isl_basic_map_dim(bmap, isl_dim_in); | 66 | 183 | n_out = isl_basic_map_dim(bmap, isl_dim_all) - n_in; | 67 | 183 | | 68 | 183 | ctx = isl_basic_map_get_ctx(bmap); | 69 | 183 | list = isl_alloc_array(ctx, int, bmap->n_ineq); | 70 | 183 | var = isl_vec_alloc(ctx, n_out); | 71 | 183 | if ((bmap->n_ineq && !list) || (n_out && !var)) | 72 | 0 | goto error; | 73 | 183 | | 74 | 183 | list[0] = first; | 75 | 183 | list[1] = second; | 76 | 183 | isl_seq_cpy(var->el, bmap->ineq[first] + 1 + n_in, n_out); | 77 | 327 | for (i = second + 1, n = 2; i < bmap->n_ineq; ++i144 ) { | 78 | 144 | if (isl_seq_eq(var->el, bmap->ineq[i] + 1 + n_in, n_out) && | 79 | 144 | all_single_occurrence(bmap, i, n_in)3 ) | 80 | 0 | list[n++] = i; | 81 | 144 | } | 82 | 183 | | 83 | 183 | cst = isl_mat_alloc(ctx, n, 1 + n_in); | 84 | 183 | if (!cst) | 85 | 0 | goto error; | 86 | 183 | | 87 | 549 | for (i = 0; 183 i < n; ++i366 ) | 88 | 366 | isl_seq_cpy(cst->row[i], bmap->ineq[list[i]], 1 + n_in); | 89 | 183 | | 90 | 183 | bmap = isl_basic_map_cow(bmap); | 91 | 183 | if (!bmap) | 92 | 0 | goto error; | 93 | 549 | for (i = n - 1; 183 i >= 0; --i366 ) | 94 | 366 | if (isl_basic_map_drop_inequality(bmap, list[i]) < 0) | 95 | 0 | goto error; | 96 | 183 | | 97 | 183 | bmap = isl_basic_map_add_dims(bmap, isl_dim_in, 1); | 98 | 183 | bmap = isl_basic_map_extend_constraints(bmap, 0, 1); | 99 | 183 | k = isl_basic_map_alloc_inequality(bmap); | 100 | 183 | if (k < 0) | 101 | 0 | goto error; | 102 | 183 | isl_seq_clr(bmap->ineq[k], 1 + n_in); | 103 | 183 | isl_int_set_si(bmap->ineq[k][1 + n_in], 1); | 104 | 183 | isl_seq_cpy(bmap->ineq[k] + 1 + n_in + 1, var->el, n_out); | 105 | 183 | bmap = isl_basic_map_finalize(bmap); | 106 | 183 | | 107 | 183 | n_div = isl_basic_set_dim(dom, isl_dim_div); | 108 | 183 | dom = isl_basic_set_add_dims(dom, isl_dim_set, 1); | 109 | 183 | dom = isl_basic_set_extend_constraints(dom, 0, n); | 110 | 549 | for (i = 0; i < n; ++i366 ) { | 111 | 366 | k = isl_basic_set_alloc_inequality(dom); | 112 | 366 | if (k < 0) | 113 | 0 | goto error; | 114 | 366 | isl_seq_cpy(dom->ineq[k], cst->row[i], 1 + n_in); | 115 | 366 | isl_int_set_si(dom->ineq[k][1 + n_in], -1); | 116 | 366 | isl_seq_clr(dom->ineq[k] + 1 + n_in + 1, n_div); | 117 | 366 | } | 118 | 183 | | 119 | 183 | isl_vec_free(var); | 120 | 183 | free(list); | 121 | 183 | | 122 | 183 | return SF(basic_map_partial_lexopt_symm_core,SUFFIX)(bmap, dom, empty, | 123 | 183 | max, cst, map_space, set_space); | 124 | 183 | error: | 125 | 0 | isl_space_free(map_space); | 126 | 0 | isl_space_free(set_space); | 127 | 0 | isl_mat_free(cst); | 128 | 0 | isl_vec_free(var); | 129 | 0 | free(list); | 130 | 0 | isl_basic_set_free(dom); | 131 | 0 | isl_basic_map_free(bmap); | 132 | 0 | return NULL; | 133 | 183 | } |
|
134 | | |
135 | | /* Recursive part of isl_tab_basic_map_partial_lexopt*, after detecting |
136 | | * equalities and removing redundant constraints. |
137 | | * |
138 | | * We first check if there are any parallel constraints (left). |
139 | | * If not, we are in the base case. |
140 | | * If there are parallel constraints, we replace them by a single |
141 | | * constraint in basic_map_partial_lexopt_symm_pma and then call |
142 | | * this function recursively to look for more parallel constraints. |
143 | | */ |
144 | | static __isl_give TYPE *SF(basic_map_partial_lexopt,SUFFIX)( |
145 | | __isl_take isl_basic_map *bmap, __isl_take isl_basic_set *dom, |
146 | | __isl_give isl_set **empty, int max) |
147 | 8.09k | { |
148 | 8.09k | isl_bool par = isl_bool_false; |
149 | 8.09k | int first, second; |
150 | 8.09k | |
151 | 8.09k | if (!bmap) |
152 | 0 | goto error; |
153 | 8.09k | |
154 | 8.09k | if (bmap->ctx->opt->pip_symmetry) |
155 | 8.09k | par = parallel_constraints(bmap, &first, &second); |
156 | 8.09k | if (par < 0) |
157 | 0 | goto error; |
158 | 8.09k | if (!par) |
159 | 7.85k | return SF(basic_map_partial_lexopt_base,SUFFIX)(bmap, dom, |
160 | 7.85k | empty, max); |
161 | 238 | |
162 | 238 | return SF(basic_map_partial_lexopt_symm,SUFFIX)(bmap, dom, empty, max, |
163 | 238 | first, second); |
164 | 238 | error: |
165 | 0 | isl_basic_set_free(dom); |
166 | 0 | isl_basic_map_free(bmap); |
167 | 0 | return NULL; |
168 | 238 | } isl_tab_pip.c:basic_map_partial_lexopt Line | Count | Source | 147 | 3.70k | { | 148 | 3.70k | isl_bool par = isl_bool_false; | 149 | 3.70k | int first, second; | 150 | 3.70k | | 151 | 3.70k | if (!bmap) | 152 | 0 | goto error; | 153 | 3.70k | | 154 | 3.70k | if (bmap->ctx->opt->pip_symmetry) | 155 | 3.70k | par = parallel_constraints(bmap, &first, &second); | 156 | 3.70k | if (par < 0) | 157 | 0 | goto error; | 158 | 3.70k | if (!par) | 159 | 3.64k | return SF(basic_map_partial_lexopt_base,SUFFIX)(bmap, dom, | 160 | 3.64k | empty, max); | 161 | 55 | | 162 | 55 | return SF(basic_map_partial_lexopt_symm,SUFFIX)(bmap, dom, empty, max, | 163 | 55 | first, second); | 164 | 55 | error: | 165 | 0 | isl_basic_set_free(dom); | 166 | 0 | isl_basic_map_free(bmap); | 167 | 0 | return NULL; | 168 | 55 | } |
isl_tab_pip.c:basic_map_partial_lexopt_pw_multi_aff Line | Count | Source | 147 | 4.39k | { | 148 | 4.39k | isl_bool par = isl_bool_false; | 149 | 4.39k | int first, second; | 150 | 4.39k | | 151 | 4.39k | if (!bmap) | 152 | 0 | goto error; | 153 | 4.39k | | 154 | 4.39k | if (bmap->ctx->opt->pip_symmetry) | 155 | 4.39k | par = parallel_constraints(bmap, &first, &second); | 156 | 4.39k | if (par < 0) | 157 | 0 | goto error; | 158 | 4.39k | if (!par) | 159 | 4.20k | return SF(basic_map_partial_lexopt_base,SUFFIX)(bmap, dom, | 160 | 4.20k | empty, max); | 161 | 183 | | 162 | 183 | return SF(basic_map_partial_lexopt_symm,SUFFIX)(bmap, dom, empty, max, | 163 | 183 | first, second); | 164 | 183 | error: | 165 | 0 | isl_basic_set_free(dom); | 166 | 0 | isl_basic_map_free(bmap); | 167 | 0 | return NULL; | 168 | 183 | } |
|
169 | | |
170 | | /* Compute the lexicographic minimum (or maximum if "flags" includes |
171 | | * ISL_OPT_MAX) of "bmap" over the domain "dom" and return the result as |
172 | | * either a map or a piecewise multi-affine expression depending on TYPE. |
173 | | * If "empty" is not NULL, then *empty is assigned a set that |
174 | | * contains those parts of the domain where there is no solution. |
175 | | * If "flags" includes ISL_OPT_FULL, then "dom" is NULL and the optimum |
176 | | * should be computed over the domain of "bmap". "empty" is also NULL |
177 | | * in this case. |
178 | | * If "bmap" is marked as rational (ISL_BASIC_MAP_RATIONAL), |
179 | | * then we compute the rational optimum. Otherwise, we compute |
180 | | * the integral optimum. |
181 | | * |
182 | | * We perform some preprocessing. As the PILP solver does not |
183 | | * handle implicit equalities very well, we first make sure all |
184 | | * the equalities are explicitly available. |
185 | | * |
186 | | * We also add context constraints to the basic map and remove |
187 | | * redundant constraints. This is only needed because of the |
188 | | * way we handle simple symmetries. In particular, we currently look |
189 | | * for symmetries on the constraints, before we set up the main tableau. |
190 | | * It is then no good to look for symmetries on possibly redundant constraints. |
191 | | * If the domain was extracted from the basic map, then there is |
192 | | * no need to add back those constraints again. |
193 | | */ |
194 | | __isl_give TYPE *SF(isl_tab_basic_map_partial_lexopt,SUFFIX)( |
195 | | __isl_take isl_basic_map *bmap, __isl_take isl_basic_set *dom, |
196 | | __isl_give isl_set **empty, unsigned flags) |
197 | 7.85k | { |
198 | 7.85k | int max, full; |
199 | 7.85k | isl_bool compatible; |
200 | 7.85k | |
201 | 7.85k | if (empty) |
202 | 3.31k | *empty = NULL; |
203 | 7.85k | |
204 | 7.85k | full = ISL_FL_ISSET(flags, ISL_OPT_FULL); |
205 | 7.85k | if (full) |
206 | 4.53k | dom = extract_domain(bmap, flags); |
207 | 7.85k | compatible = isl_basic_map_compatible_domain(bmap, dom); |
208 | 7.85k | if (compatible < 0) |
209 | 0 | goto error; |
210 | 7.85k | if (!compatible) |
211 | 7.85k | isl_die0 (isl_basic_map_get_ctx(bmap), isl_error_invalid, |
212 | 7.85k | "domain does not match input", goto error); |
213 | 7.85k | |
214 | 7.85k | max = ISL_FL_ISSET(flags, ISL_OPT_MAX); |
215 | 7.85k | if (isl_basic_set_dim(dom, isl_dim_all) == 0) |
216 | 1.48k | return SF(basic_map_partial_lexopt,SUFFIX)(bmap, dom, empty, |
217 | 1.48k | max); |
218 | 6.37k | |
219 | 6.37k | if (!full) |
220 | 3.29k | bmap = isl_basic_map_intersect_domain(bmap, |
221 | 3.29k | isl_basic_set_copy(dom)); |
222 | 6.37k | bmap = isl_basic_map_detect_equalities(bmap); |
223 | 6.37k | bmap = isl_basic_map_remove_redundancies(bmap); |
224 | 6.37k | |
225 | 6.37k | return SF(basic_map_partial_lexopt,SUFFIX)(bmap, dom, empty, max); |
226 | 6.37k | error: |
227 | 0 | isl_basic_set_free(dom); |
228 | 0 | isl_basic_map_free(bmap); |
229 | 0 | return NULL; |
230 | 6.37k | } isl_tab_basic_map_partial_lexopt Line | Count | Source | 197 | 3.64k | { | 198 | 3.64k | int max, full; | 199 | 3.64k | isl_bool compatible; | 200 | 3.64k | | 201 | 3.64k | if (empty) | 202 | 2.75k | *empty = NULL; | 203 | 3.64k | | 204 | 3.64k | full = ISL_FL_ISSET(flags, ISL_OPT_FULL); | 205 | 3.64k | if (full) | 206 | 894 | dom = extract_domain(bmap, flags); | 207 | 3.64k | compatible = isl_basic_map_compatible_domain(bmap, dom); | 208 | 3.64k | if (compatible < 0) | 209 | 0 | goto error; | 210 | 3.64k | if (!compatible) | 211 | 3.64k | isl_die0 (isl_basic_map_get_ctx(bmap), isl_error_invalid, | 212 | 3.64k | "domain does not match input", goto error); | 213 | 3.64k | | 214 | 3.64k | max = ISL_FL_ISSET(flags, ISL_OPT_MAX); | 215 | 3.64k | if (isl_basic_set_dim(dom, isl_dim_all) == 0) | 216 | 95 | return SF(basic_map_partial_lexopt,SUFFIX)(bmap, dom, empty, | 217 | 95 | max); | 218 | 3.55k | | 219 | 3.55k | if (!full) | 220 | 2.73k | bmap = isl_basic_map_intersect_domain(bmap, | 221 | 2.73k | isl_basic_set_copy(dom)); | 222 | 3.55k | bmap = isl_basic_map_detect_equalities(bmap); | 223 | 3.55k | bmap = isl_basic_map_remove_redundancies(bmap); | 224 | 3.55k | | 225 | 3.55k | return SF(basic_map_partial_lexopt,SUFFIX)(bmap, dom, empty, max); | 226 | 3.55k | error: | 227 | 0 | isl_basic_set_free(dom); | 228 | 0 | isl_basic_map_free(bmap); | 229 | 0 | return NULL; | 230 | 3.55k | } |
isl_tab_basic_map_partial_lexopt_pw_multi_aff Line | Count | Source | 197 | 4.20k | { | 198 | 4.20k | int max, full; | 199 | 4.20k | isl_bool compatible; | 200 | 4.20k | | 201 | 4.20k | if (empty) | 202 | 567 | *empty = NULL; | 203 | 4.20k | | 204 | 4.20k | full = ISL_FL_ISSET(flags, ISL_OPT_FULL); | 205 | 4.20k | if (full) | 206 | 3.64k | dom = extract_domain(bmap, flags); | 207 | 4.20k | compatible = isl_basic_map_compatible_domain(bmap, dom); | 208 | 4.20k | if (compatible < 0) | 209 | 0 | goto error; | 210 | 4.20k | if (!compatible) | 211 | 4.20k | isl_die0 (isl_basic_map_get_ctx(bmap), isl_error_invalid, | 212 | 4.20k | "domain does not match input", goto error); | 213 | 4.20k | | 214 | 4.20k | max = ISL_FL_ISSET(flags, ISL_OPT_MAX); | 215 | 4.20k | if (isl_basic_set_dim(dom, isl_dim_all) == 0) | 216 | 1.38k | return SF(basic_map_partial_lexopt,SUFFIX)(bmap, dom, empty, | 217 | 1.38k | max); | 218 | 2.82k | | 219 | 2.82k | if (!full) | 220 | 567 | bmap = isl_basic_map_intersect_domain(bmap, | 221 | 567 | isl_basic_set_copy(dom)); | 222 | 2.82k | bmap = isl_basic_map_detect_equalities(bmap); | 223 | 2.82k | bmap = isl_basic_map_remove_redundancies(bmap); | 224 | 2.82k | | 225 | 2.82k | return SF(basic_map_partial_lexopt,SUFFIX)(bmap, dom, empty, max); | 226 | 2.82k | error: | 227 | 0 | isl_basic_set_free(dom); | 228 | 0 | isl_basic_map_free(bmap); | 229 | 0 | return NULL; | 230 | 2.82k | } |
|