[clang-repl] [codegen] Reduce the state in TBAA. NFC for static compilation. (#98138)
[llvm-project.git] / polly / lib / External / isl / isl_multi_add_constant_templ.c
bloba54f3fa720117249a7f4bd2b61567e42e27089c9
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 #include <isl_multi_macro.h>
12 /* Add "v" to the constant terms of all the base expressions of "multi".
14 __isl_give MULTI(BASE) *FN(MULTI(BASE),add_constant_val)(
15 __isl_take MULTI(BASE) *multi, __isl_take isl_val *v)
17 isl_bool zero;
19 zero = isl_val_is_zero(v);
20 if (zero < 0)
21 goto error;
22 if (zero) {
23 isl_val_free(v);
24 return multi;
27 return FN(MULTI(BASE),fn_val)(multi, &FN(EL,add_constant_val), v);
28 error:
29 FN(MULTI(BASE),free)(multi);
30 isl_val_free(v);
31 return NULL;
34 /* Add the elements of "mv" to the constant terms of
35 * the corresponding base expressions of "multi".
37 __isl_give MULTI(BASE) *FN(MULTI(BASE),add_constant_multi_val)(
38 __isl_take MULTI(BASE) *multi, __isl_take isl_multi_val *mv)
40 isl_bool zero;
42 zero = isl_multi_val_is_zero(mv);
43 if (zero < 0)
44 goto error;
45 if (zero) {
46 isl_multi_val_free(mv);
47 return multi;
50 return FN(MULTI(BASE),fn_multi_val)(multi, &FN(EL,add_constant_val),
51 mv);
53 error:
54 FN(MULTI(BASE),free)(multi);
55 isl_multi_val_free(mv);
56 return NULL;