isl_map.c: find_later_constraint_in_pair: stop search after near hit
[isl.git] / isl_insert_domain_templ.c
blob0b88d1c0d857769a2424b6705336584e25bd034e
1 /*
2 * Copyright 2019 Cerebras Systems
4 * Use of this software is governed by the MIT license
6 * Written by Sven Verdoolaege,
7 * Cerebras Systems, 175 S San Antonio Rd, Los Altos, CA, USA
8 */
10 /* Given a function defined over a parameter domain,
11 * convert it to a function defined over a domain corresponding
12 * to "domain".
14 __isl_give TYPE *FN(TYPE,insert_domain)(__isl_take TYPE *obj,
15 __isl_take isl_space *domain)
17 isl_size dim;
18 isl_space *obj_space;
20 obj_space = FN(TYPE,peek_space)(obj);
21 if (isl_space_check_is_set(domain) < 0 ||
22 isl_space_check_is_set(obj_space) < 0)
23 goto error;
24 dim = isl_space_dim(domain, isl_dim_set);
25 if (dim < 0)
26 goto error;
28 domain = isl_space_replace_params(domain, obj_space);
30 obj = FN(TYPE,from_range)(obj);
31 obj = FN(TYPE,add_dims)(obj, isl_dim_in, dim);
32 obj = FN(TYPE,reset_domain_space)(obj, domain);
34 return obj;
35 error:
36 isl_space_free(domain);
37 FN(TYPE,free)(obj);
38 return NULL;