Coverage Report

Created: 2017-06-23 12:40

/Users/buildslave/jenkins/sharedspace/clang-stage2-coverage-R@2/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
11.0k
#define xSF(TYPE,SUFFIX) TYPE ## SUFFIX
15
11.0k
#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
74
{
53
74
  int i, n, k;
54
74
  int *list = NULL;
55
74
  unsigned n_in, n_out, n_div;
56
74
  isl_ctx *ctx;
57
74
  isl_vec *var = NULL;
58
74
  isl_mat *cst = NULL;
59
74
  isl_space *map_space, *set_space;
60
74
61
74
  map_space = isl_basic_map_get_space(bmap);
62
6
  set_space = empty ? isl_basic_set_get_space(dom) : NULL;
63
74
64
74
  n_in = isl_basic_map_dim(bmap, isl_dim_param) +
65
74
         isl_basic_map_dim(bmap, isl_dim_in);
66
74
  n_out = isl_basic_map_dim(bmap, isl_dim_all) - n_in;
67
74
68
74
  ctx = isl_basic_map_get_ctx(bmap);
69
74
  list = isl_alloc_array(ctx, int, bmap->n_ineq);
70
74
  var = isl_vec_alloc(ctx, n_out);
71
74
  if (
(bmap->n_ineq && 74
!list74
) ||
(n_out && 74
!var74
))
72
0
    goto error;
73
74
74
74
  list[0] = first;
75
74
  list[1] = second;
76
74
  isl_seq_cpy(var->el, bmap->ineq[first] + 1 + n_in, n_out);
77
162
  for (i = second + 1, n = 2; 
i < bmap->n_ineq162
;
++i88
)
{88
78
88
    if (isl_seq_eq(var->el, bmap->ineq[i] + 1 + n_in, n_out) &&
79
0
        all_single_occurrence(bmap, i, n_in))
80
0
      list[n++] = i;
81
88
  }
82
74
83
74
  cst = isl_mat_alloc(ctx, n, 1 + n_in);
84
74
  if (!cst)
85
0
    goto error;
86
74
87
222
  
for (i = 0; 74
i < n222
;
++i148
)
88
148
    isl_seq_cpy(cst->row[i], bmap->ineq[list[i]], 1 + n_in);
89
74
90
74
  bmap = isl_basic_map_cow(bmap);
91
74
  if (!bmap)
92
0
    goto error;
93
222
  
for (i = n - 1; 74
i >= 0222
;
--i148
)
94
148
    
if (148
isl_basic_map_drop_inequality(bmap, list[i]) < 0148
)
95
0
      goto error;
96
74
97
74
  bmap = isl_basic_map_add_dims(bmap, isl_dim_in, 1);
98
74
  bmap = isl_basic_map_extend_constraints(bmap, 0, 1);
99
74
  k = isl_basic_map_alloc_inequality(bmap);
100
74
  if (k < 0)
101
0
    goto error;
102
74
  isl_seq_clr(bmap->ineq[k], 1 + n_in);
103
74
  isl_int_set_si(bmap->ineq[k][1 + n_in], 1);
104
74
  isl_seq_cpy(bmap->ineq[k] + 1 + n_in + 1, var->el, n_out);
105
74
  bmap = isl_basic_map_finalize(bmap);
106
74
107
74
  n_div = isl_basic_set_dim(dom, isl_dim_div);
108
74
  dom = isl_basic_set_add_dims(dom, isl_dim_set, 1);
109
74
  dom = isl_basic_set_extend_constraints(dom, 0, n);
110
222
  for (i = 0; 
i < n222
;
++i148
)
{148
111
148
    k = isl_basic_set_alloc_inequality(dom);
112
148
    if (k < 0)
113
0
      goto error;
114
148
    isl_seq_cpy(dom->ineq[k], cst->row[i], 1 + n_in);
115
148
    isl_int_set_si(dom->ineq[k][1 + n_in], -1);
116
148
    isl_seq_clr(dom->ineq[k] + 1 + n_in + 1, n_div);
117
148
  }
118
74
119
74
  isl_vec_free(var);
120
74
  free(list);
121
74
122
74
  return SF(basic_map_partial_lexopt_symm_core,SUFFIX)(bmap, dom, empty,
123
74
            max, cst, map_space, set_space);
124
0
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
74
}
isl_tab_pip.c:basic_map_partial_lexopt_symm
Line
Count
Source
52
43
{
53
43
  int i, n, k;
54
43
  int *list = NULL;
55
43
  unsigned n_in, n_out, n_div;
56
43
  isl_ctx *ctx;
57
43
  isl_vec *var = NULL;
58
43
  isl_mat *cst = NULL;
59
43
  isl_space *map_space, *set_space;
60
43
61
43
  map_space = isl_basic_map_get_space(bmap);
62
6
  set_space = empty ? isl_basic_set_get_space(dom) : NULL;
63
43
64
43
  n_in = isl_basic_map_dim(bmap, isl_dim_param) +
65
43
         isl_basic_map_dim(bmap, isl_dim_in);
66
43
  n_out = isl_basic_map_dim(bmap, isl_dim_all) - n_in;
67
43
68
43
  ctx = isl_basic_map_get_ctx(bmap);
69
43
  list = isl_alloc_array(ctx, int, bmap->n_ineq);
70
43
  var = isl_vec_alloc(ctx, n_out);
71
43
  if (
(bmap->n_ineq && 43
!list43
) ||
(n_out && 43
!var43
))
72
0
    goto error;
73
43
74
43
  list[0] = first;
75
43
  list[1] = second;
76
43
  isl_seq_cpy(var->el, bmap->ineq[first] + 1 + n_in, n_out);
77
106
  for (i = second + 1, n = 2; 
i < bmap->n_ineq106
;
++i63
)
{63
78
63
    if (isl_seq_eq(var->el, bmap->ineq[i] + 1 + n_in, n_out) &&
79
0
        all_single_occurrence(bmap, i, n_in))
80
0
      list[n++] = i;
81
63
  }
82
43
83
43
  cst = isl_mat_alloc(ctx, n, 1 + n_in);
84
43
  if (!cst)
85
0
    goto error;
86
43
87
129
  
for (i = 0; 43
i < n129
;
++i86
)
88
86
    isl_seq_cpy(cst->row[i], bmap->ineq[list[i]], 1 + n_in);
89
43
90
43
  bmap = isl_basic_map_cow(bmap);
91
43
  if (!bmap)
92
0
    goto error;
93
129
  
for (i = n - 1; 43
i >= 0129
;
--i86
)
94
86
    
if (86
isl_basic_map_drop_inequality(bmap, list[i]) < 086
)
95
0
      goto error;
96
43
97
43
  bmap = isl_basic_map_add_dims(bmap, isl_dim_in, 1);
98
43
  bmap = isl_basic_map_extend_constraints(bmap, 0, 1);
99
43
  k = isl_basic_map_alloc_inequality(bmap);
100
43
  if (k < 0)
101
0
    goto error;
102
43
  isl_seq_clr(bmap->ineq[k], 1 + n_in);
103
43
  isl_int_set_si(bmap->ineq[k][1 + n_in], 1);
104
43
  isl_seq_cpy(bmap->ineq[k] + 1 + n_in + 1, var->el, n_out);
105
43
  bmap = isl_basic_map_finalize(bmap);
106
43
107
43
  n_div = isl_basic_set_dim(dom, isl_dim_div);
108
43
  dom = isl_basic_set_add_dims(dom, isl_dim_set, 1);
109
43
  dom = isl_basic_set_extend_constraints(dom, 0, n);
110
129
  for (i = 0; 
i < n129
;
++i86
)
{86
111
86
    k = isl_basic_set_alloc_inequality(dom);
112
86
    if (k < 0)
113
0
      goto error;
114
86
    isl_seq_cpy(dom->ineq[k], cst->row[i], 1 + n_in);
115
86
    isl_int_set_si(dom->ineq[k][1 + n_in], -1);
116
86
    isl_seq_clr(dom->ineq[k] + 1 + n_in + 1, n_div);
117
86
  }
118
43
119
43
  isl_vec_free(var);
120
43
  free(list);
121
43
122
43
  return SF(basic_map_partial_lexopt_symm_core,SUFFIX)(bmap, dom, empty,
123
43
            max, cst, map_space, set_space);
124
0
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
43
}
isl_tab_pip.c:basic_map_partial_lexopt_symm_pw_multi_aff
Line
Count
Source
52
31
{
53
31
  int i, n, k;
54
31
  int *list = NULL;
55
31
  unsigned n_in, n_out, n_div;
56
31
  isl_ctx *ctx;
57
31
  isl_vec *var = NULL;
58
31
  isl_mat *cst = NULL;
59
31
  isl_space *map_space, *set_space;
60
31
61
31
  map_space = isl_basic_map_get_space(bmap);
62
0
  set_space = empty ? isl_basic_set_get_space(dom) : NULL;
63
31
64
31
  n_in = isl_basic_map_dim(bmap, isl_dim_param) +
65
31
         isl_basic_map_dim(bmap, isl_dim_in);
66
31
  n_out = isl_basic_map_dim(bmap, isl_dim_all) - n_in;
67
31
68
31
  ctx = isl_basic_map_get_ctx(bmap);
69
31
  list = isl_alloc_array(ctx, int, bmap->n_ineq);
70
31
  var = isl_vec_alloc(ctx, n_out);
71
31
  if (
(bmap->n_ineq && 31
!list31
) ||
(n_out && 31
!var31
))
72
0
    goto error;
73
31
74
31
  list[0] = first;
75
31
  list[1] = second;
76
31
  isl_seq_cpy(var->el, bmap->ineq[first] + 1 + n_in, n_out);
77
56
  for (i = second + 1, n = 2; 
i < bmap->n_ineq56
;
++i25
)
{25
78
25
    if (isl_seq_eq(var->el, bmap->ineq[i] + 1 + n_in, n_out) &&
79
0
        all_single_occurrence(bmap, i, n_in))
80
0
      list[n++] = i;
81
25
  }
82
31
83
31
  cst = isl_mat_alloc(ctx, n, 1 + n_in);
84
31
  if (!cst)
85
0
    goto error;
86
31
87
93
  
for (i = 0; 31
i < n93
;
++i62
)
88
62
    isl_seq_cpy(cst->row[i], bmap->ineq[list[i]], 1 + n_in);
89
31
90
31
  bmap = isl_basic_map_cow(bmap);
91
31
  if (!bmap)
92
0
    goto error;
93
93
  
for (i = n - 1; 31
i >= 093
;
--i62
)
94
62
    
if (62
isl_basic_map_drop_inequality(bmap, list[i]) < 062
)
95
0
      goto error;
96
31
97
31
  bmap = isl_basic_map_add_dims(bmap, isl_dim_in, 1);
98
31
  bmap = isl_basic_map_extend_constraints(bmap, 0, 1);
99
31
  k = isl_basic_map_alloc_inequality(bmap);
100
31
  if (k < 0)
101
0
    goto error;
102
31
  isl_seq_clr(bmap->ineq[k], 1 + n_in);
103
31
  isl_int_set_si(bmap->ineq[k][1 + n_in], 1);
104
31
  isl_seq_cpy(bmap->ineq[k] + 1 + n_in + 1, var->el, n_out);
105
31
  bmap = isl_basic_map_finalize(bmap);
106
31
107
31
  n_div = isl_basic_set_dim(dom, isl_dim_div);
108
31
  dom = isl_basic_set_add_dims(dom, isl_dim_set, 1);
109
31
  dom = isl_basic_set_extend_constraints(dom, 0, n);
110
93
  for (i = 0; 
i < n93
;
++i62
)
{62
111
62
    k = isl_basic_set_alloc_inequality(dom);
112
62
    if (k < 0)
113
0
      goto error;
114
62
    isl_seq_cpy(dom->ineq[k], cst->row[i], 1 + n_in);
115
62
    isl_int_set_si(dom->ineq[k][1 + n_in], -1);
116
62
    isl_seq_clr(dom->ineq[k] + 1 + n_in + 1, n_div);
117
62
  }
118
31
119
31
  isl_vec_free(var);
120
31
  free(list);
121
31
122
31
  return SF(basic_map_partial_lexopt_symm_core,SUFFIX)(bmap, dom, empty,
123
31
            max, cst, map_space, set_space);
124
0
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
31
}
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
5.53k
{
148
5.53k
  isl_bool par = isl_bool_false;
149
5.53k
  int first, second;
150
5.53k
151
5.53k
  if (!bmap)
152
0
    goto error;
153
5.53k
154
5.53k
  
if (5.53k
bmap->ctx->opt->pip_symmetry5.53k
)
155
5.53k
    par = parallel_constraints(bmap, &first, &second);
156
5.53k
  if (par < 0)
157
0
    goto error;
158
5.53k
  
if (5.53k
!par5.53k
)
159
5.46k
    
return 5.46k
SF5.46k
(basic_map_partial_lexopt_base,SUFFIX)(bmap, dom,
160
5.46k
                empty, max);
161
5.53k
162
74
  
return 74
SF74
(basic_map_partial_lexopt_symm,SUFFIX)(bmap, dom, empty, max,
163
74
               first, second);
164
0
error:
165
0
  isl_basic_set_free(dom);
166
0
  isl_basic_map_free(bmap);
167
0
  return NULL;
168
5.53k
}
isl_tab_pip.c:basic_map_partial_lexopt
Line
Count
Source
147
2.62k
{
148
2.62k
  isl_bool par = isl_bool_false;
149
2.62k
  int first, second;
150
2.62k
151
2.62k
  if (!bmap)
152
0
    goto error;
153
2.62k
154
2.62k
  
if (2.62k
bmap->ctx->opt->pip_symmetry2.62k
)
155
2.62k
    par = parallel_constraints(bmap, &first, &second);
156
2.62k
  if (par < 0)
157
0
    goto error;
158
2.62k
  
if (2.62k
!par2.62k
)
159
2.58k
    
return 2.58k
SF2.58k
(basic_map_partial_lexopt_base,SUFFIX)(bmap, dom,
160
2.58k
                empty, max);
161
2.62k
162
43
  
return 43
SF43
(basic_map_partial_lexopt_symm,SUFFIX)(bmap, dom, empty, max,
163
43
               first, second);
164
0
error:
165
0
  isl_basic_set_free(dom);
166
0
  isl_basic_map_free(bmap);
167
0
  return NULL;
168
2.62k
}
isl_tab_pip.c:basic_map_partial_lexopt_pw_multi_aff
Line
Count
Source
147
2.90k
{
148
2.90k
  isl_bool par = isl_bool_false;
149
2.90k
  int first, second;
150
2.90k
151
2.90k
  if (!bmap)
152
0
    goto error;
153
2.90k
154
2.90k
  
if (2.90k
bmap->ctx->opt->pip_symmetry2.90k
)
155
2.90k
    par = parallel_constraints(bmap, &first, &second);
156
2.90k
  if (par < 0)
157
0
    goto error;
158
2.90k
  
if (2.90k
!par2.90k
)
159
2.87k
    
return 2.87k
SF2.87k
(basic_map_partial_lexopt_base,SUFFIX)(bmap, dom,
160
2.87k
                empty, max);
161
2.90k
162
31
  
return 31
SF31
(basic_map_partial_lexopt_symm,SUFFIX)(bmap, dom, empty, max,
163
31
               first, second);
164
0
error:
165
0
  isl_basic_set_free(dom);
166
0
  isl_basic_map_free(bmap);
167
0
  return NULL;
168
2.90k
}
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
5.47k
{
198
5.47k
  int max, full;
199
5.47k
  isl_bool compatible;
200
5.47k
201
5.47k
  if (empty)
202
3.11k
    *empty = NULL;
203
5.47k
204
5.47k
  full = ISL_FL_ISSET(flags, ISL_OPT_FULL);
205
5.47k
  if (full)
206
2.36k
    dom = extract_domain(bmap, flags);
207
5.47k
  compatible = isl_basic_map_compatible_domain(bmap, dom);
208
5.47k
  if (compatible < 0)
209
15
    goto error;
210
5.46k
  
if (5.46k
!compatible5.46k
)
211
0
    isl_die(isl_basic_map_get_ctx(bmap), isl_error_invalid,
212
5.46k
      "domain does not match input", goto error);
213
5.46k
214
5.46k
  
max = 5.46k
ISL_FL_ISSET5.46k
(flags, ISL_OPT_MAX);
215
5.46k
  if (isl_basic_set_dim(dom, isl_dim_all) == 0)
216
657
    
return 657
SF657
(basic_map_partial_lexopt,SUFFIX)(bmap, dom, empty,
217
657
                  max);
218
5.46k
219
4.80k
  
if (4.80k
!full4.80k
)
220
3.08k
    bmap = isl_basic_map_intersect_domain(bmap,
221
3.08k
                isl_basic_set_copy(dom));
222
4.80k
  bmap = isl_basic_map_detect_equalities(bmap);
223
4.80k
  bmap = isl_basic_map_remove_redundancies(bmap);
224
4.80k
225
4.80k
  return SF(basic_map_partial_lexopt,SUFFIX)(bmap, dom, empty, max);
226
15
error:
227
15
  isl_basic_set_free(dom);
228
15
  isl_basic_map_free(bmap);
229
15
  return NULL;
230
5.46k
}
isl_tab_basic_map_partial_lexopt
Line
Count
Source
197
2.58k
{
198
2.58k
  int max, full;
199
2.58k
  isl_bool compatible;
200
2.58k
201
2.58k
  if (empty)
202
2.04k
    *empty = NULL;
203
2.58k
204
2.58k
  full = ISL_FL_ISSET(flags, ISL_OPT_FULL);
205
2.58k
  if (full)
206
539
    dom = extract_domain(bmap, flags);
207
2.58k
  compatible = isl_basic_map_compatible_domain(bmap, dom);
208
2.58k
  if (compatible < 0)
209
0
    goto error;
210
2.58k
  
if (2.58k
!compatible2.58k
)
211
0
    isl_die(isl_basic_map_get_ctx(bmap), isl_error_invalid,
212
2.58k
      "domain does not match input", goto error);
213
2.58k
214
2.58k
  
max = 2.58k
ISL_FL_ISSET2.58k
(flags, ISL_OPT_MAX);
215
2.58k
  if (isl_basic_set_dim(dom, isl_dim_all) == 0)
216
77
    
return 77
SF77
(basic_map_partial_lexopt,SUFFIX)(bmap, dom, empty,
217
77
                  max);
218
2.58k
219
2.50k
  
if (2.50k
!full2.50k
)
220
2.02k
    bmap = isl_basic_map_intersect_domain(bmap,
221
2.02k
                isl_basic_set_copy(dom));
222
2.50k
  bmap = isl_basic_map_detect_equalities(bmap);
223
2.50k
  bmap = isl_basic_map_remove_redundancies(bmap);
224
2.50k
225
2.50k
  return SF(basic_map_partial_lexopt,SUFFIX)(bmap, dom, empty, max);
226
0
error:
227
0
  isl_basic_set_free(dom);
228
0
  isl_basic_map_free(bmap);
229
0
  return NULL;
230
2.58k
}
isl_tab_basic_map_partial_lexopt_pw_multi_aff
Line
Count
Source
197
2.89k
{
198
2.89k
  int max, full;
199
2.89k
  isl_bool compatible;
200
2.89k
201
2.89k
  if (empty)
202
1.06k
    *empty = NULL;
203
2.89k
204
2.89k
  full = ISL_FL_ISSET(flags, ISL_OPT_FULL);
205
2.89k
  if (full)
206
1.82k
    dom = extract_domain(bmap, flags);
207
2.89k
  compatible = isl_basic_map_compatible_domain(bmap, dom);
208
2.89k
  if (compatible < 0)
209
15
    goto error;
210
2.87k
  
if (2.87k
!compatible2.87k
)
211
0
    isl_die(isl_basic_map_get_ctx(bmap), isl_error_invalid,
212
2.87k
      "domain does not match input", goto error);
213
2.87k
214
2.87k
  
max = 2.87k
ISL_FL_ISSET2.87k
(flags, ISL_OPT_MAX);
215
2.87k
  if (isl_basic_set_dim(dom, isl_dim_all) == 0)
216
580
    
return 580
SF580
(basic_map_partial_lexopt,SUFFIX)(bmap, dom, empty,
217
580
                  max);
218
2.87k
219
2.29k
  
if (2.29k
!full2.29k
)
220
1.06k
    bmap = isl_basic_map_intersect_domain(bmap,
221
1.06k
                isl_basic_set_copy(dom));
222
2.29k
  bmap = isl_basic_map_detect_equalities(bmap);
223
2.29k
  bmap = isl_basic_map_remove_redundancies(bmap);
224
2.29k
225
2.29k
  return SF(basic_map_partial_lexopt,SUFFIX)(bmap, dom, empty, max);
226
15
error:
227
15
  isl_basic_set_free(dom);
228
15
  isl_basic_map_free(bmap);
229
15
  return NULL;
230
2.87k
}