[clang-repl] [codegen] Reduce the state in TBAA. NFC for static compilation. (#98138)
[llvm-project.git] / polly / lib / External / isl / isl_pw_morph_templ.c
blob3c08698a9a987bb90da666e5abdf653fa409736e
1 /*
2 * Copyright 2010 INRIA Saclay
4 * Use of this software is governed by the MIT license
6 * Written by Sven Verdoolaege, INRIA Saclay - Ile-de-France,
7 * Parc Club Orsay Universite, ZAC des vignes, 4 rue Jacques Monod,
8 * 91893 Orsay, France
9 */
11 __isl_give PW *FN(PW,morph_domain)(__isl_take PW *pw,
12 __isl_take isl_morph *morph)
14 int i;
15 isl_size n;
16 isl_ctx *ctx;
17 isl_space *space;
19 n = FN(PW,n_piece)(pw);
20 if (n < 0 || !morph)
21 goto error;
23 ctx = isl_space_get_ctx(pw->dim);
24 isl_assert(ctx, isl_space_is_domain_internal(morph->dom->dim, pw->dim),
25 goto error);
27 space = FN(PW,take_space)(pw);
28 space = isl_space_extend_domain_with_range(
29 isl_space_copy(morph->ran->dim), space);
30 pw = FN(PW,restore_space)(pw, space);
32 for (i = 0; i < n; ++i) {
33 isl_set *domain;
34 EL *el;
36 domain = FN(PW,take_domain_at)(pw, i);
37 domain = isl_morph_set(isl_morph_copy(morph), domain);
38 pw = FN(PW,restore_domain_at)(pw, i, domain);
39 el = FN(PW,take_base_at)(pw, i);
40 el = FN(EL,morph_domain)(el, isl_morph_copy(morph));
41 pw = FN(PW,restore_base_at)(pw, i, el);
44 isl_morph_free(morph);
46 return pw;
47 error:
48 FN(PW,free)(pw);
49 isl_morph_free(morph);
50 return NULL;