Coverage Report

Created: 2019-04-21 11:35

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/tools/polly/lib/External/isl/isl_multi_apply_templ.c
Line
Count
Source (jump to first uncovered line)
1
/*
2
 * Copyright 2011      Sven Verdoolaege
3
 * Copyright 2012-2013 Ecole Normale Superieure
4
 *
5
 * Use of this software is governed by the MIT license
6
 *
7
 * Written by Sven Verdoolaege,
8
 * Ecole Normale Superieure, 45 rue d’Ulm, 75230 Paris, France
9
 */
10
11
#include <isl_multi_macro.h>
12
13
/* Transform the elements of "multi" by applying "fn" to them
14
 * with extra argument "set".
15
 *
16
 * The parameters of "multi" and "set" are assumed to have been aligned.
17
 */
18
__isl_give MULTI(BASE) *FN(FN(MULTI(BASE),apply_aligned),APPLY_DOMBASE)(
19
  __isl_take MULTI(BASE) *multi, __isl_take APPLY_DOM *set,
20
  __isl_give EL *(*fn)(EL *el, __isl_take APPLY_DOM *set))
21
1.52k
{
22
1.52k
  int i;
23
1.52k
24
1.52k
  if (!multi || !set)
25
0
    goto error;
26
1.52k
27
1.52k
  if (multi->n == 0) {
28
15
    FN(APPLY_DOM,free)(set);
29
15
    return multi;
30
15
  }
31
1.51k
32
1.51k
  multi = FN(MULTI(BASE),cow)(multi);
33
1.51k
  if (!multi)
34
0
    goto error;
35
1.51k
36
4.06k
  
for (i = 0; 1.51k
i < multi->n;
++i2.55k
) {
37
2.55k
    multi->u.p[i] = fn(multi->u.p[i], FN(APPLY_DOM,copy)(set));
38
2.55k
    if (!multi->u.p[i])
39
0
      goto error;
40
2.55k
  }
41
1.51k
42
1.51k
  FN(APPLY_DOM,free)(set);
43
1.51k
  return multi;
44
1.51k
error:
45
0
  FN(APPLY_DOM,free)(set);
46
0
  FN(MULTI(BASE),free)(multi);
47
0
  return NULL;
48
1.51k
}
isl_multi_aff_apply_aligned_set
Line
Count
Source
21
862
{
22
862
  int i;
23
862
24
862
  if (!multi || !set)
25
0
    goto error;
26
862
27
862
  if (multi->n == 0) {
28
15
    FN(APPLY_DOM,free)(set);
29
15
    return multi;
30
15
  }
31
847
32
847
  multi = FN(MULTI(BASE),cow)(multi);
33
847
  if (!multi)
34
0
    goto error;
35
847
36
2.70k
  
for (i = 0; 847
i < multi->n;
++i1.86k
) {
37
1.86k
    multi->u.p[i] = fn(multi->u.p[i], FN(APPLY_DOM,copy)(set));
38
1.86k
    if (!multi->u.p[i])
39
0
      goto error;
40
1.86k
  }
41
847
42
847
  FN(APPLY_DOM,free)(set);
43
847
  return multi;
44
847
error:
45
0
  FN(APPLY_DOM,free)(set);
46
0
  FN(MULTI(BASE),free)(multi);
47
0
  return NULL;
48
847
}
isl_multi_pw_aff_apply_aligned_set
Line
Count
Source
21
88
{
22
88
  int i;
23
88
24
88
  if (!multi || !set)
25
0
    goto error;
26
88
27
88
  if (multi->n == 0) {
28
0
    FN(APPLY_DOM,free)(set);
29
0
    return multi;
30
0
  }
31
88
32
88
  multi = FN(MULTI(BASE),cow)(multi);
33
88
  if (!multi)
34
0
    goto error;
35
88
36
201
  
for (i = 0; 88
i < multi->n;
++i113
) {
37
113
    multi->u.p[i] = fn(multi->u.p[i], FN(APPLY_DOM,copy)(set));
38
113
    if (!multi->u.p[i])
39
0
      goto error;
40
113
  }
41
88
42
88
  FN(APPLY_DOM,free)(set);
43
88
  return multi;
44
88
error:
45
0
  FN(APPLY_DOM,free)(set);
46
0
  FN(MULTI(BASE),free)(multi);
47
0
  return NULL;
48
88
}
isl_multi_union_pw_aff_apply_aligned_set
Line
Count
Source
21
407
{
22
407
  int i;
23
407
24
407
  if (!multi || !set)
25
0
    goto error;
26
407
27
407
  if (multi->n == 0) {
28
0
    FN(APPLY_DOM,free)(set);
29
0
    return multi;
30
0
  }
31
407
32
407
  multi = FN(MULTI(BASE),cow)(multi);
33
407
  if (!multi)
34
0
    goto error;
35
407
36
814
  
for (i = 0; 407
i < multi->n;
++i407
) {
37
407
    multi->u.p[i] = fn(multi->u.p[i], FN(APPLY_DOM,copy)(set));
38
407
    if (!multi->u.p[i])
39
0
      goto error;
40
407
  }
41
407
42
407
  FN(APPLY_DOM,free)(set);
43
407
  return multi;
44
407
error:
45
0
  FN(APPLY_DOM,free)(set);
46
0
  FN(MULTI(BASE),free)(multi);
47
0
  return NULL;
48
407
}
isl_multi_union_pw_aff_apply_aligned_union_set
Line
Count
Source
21
169
{
22
169
  int i;
23
169
24
169
  if (!multi || !set)
25
0
    goto error;
26
169
27
169
  if (multi->n == 0) {
28
0
    FN(APPLY_DOM,free)(set);
29
0
    return multi;
30
0
  }
31
169
32
169
  multi = FN(MULTI(BASE),cow)(multi);
33
169
  if (!multi)
34
0
    goto error;
35
169
36
346
  
for (i = 0; 169
i < multi->n;
++i177
) {
37
177
    multi->u.p[i] = fn(multi->u.p[i], FN(APPLY_DOM,copy)(set));
38
177
    if (!multi->u.p[i])
39
0
      goto error;
40
177
  }
41
169
42
169
  FN(APPLY_DOM,free)(set);
43
169
  return multi;
44
169
error:
45
0
  FN(APPLY_DOM,free)(set);
46
0
  FN(MULTI(BASE),free)(multi);
47
0
  return NULL;
48
169
}
49
50
/* Transform the elements of "multi" by applying "fn" to them
51
 * with extra argument "set".
52
 *
53
 * Align the parameters if needed and call apply_set_aligned.
54
 */
55
static __isl_give MULTI(BASE) *FN(FN(MULTI(BASE),apply),APPLY_DOMBASE)(
56
  __isl_take MULTI(BASE) *multi, __isl_take APPLY_DOM *set,
57
  __isl_give EL *(*fn)(EL *el, __isl_take APPLY_DOM *set))
58
1.52k
{
59
1.52k
  isl_bool aligned;
60
1.52k
  isl_ctx *ctx;
61
1.52k
62
1.52k
  if (!multi || !set)
63
0
    goto error;
64
1.52k
65
1.52k
  aligned = FN(APPLY_DOM,space_has_equal_params)(set, multi->space);
66
1.52k
  if (aligned < 0)
67
0
    goto error;
68
1.52k
  if (aligned)
69
1.49k
    return FN(FN(MULTI(BASE),apply_aligned),APPLY_DOMBASE)(multi,
70
1.49k
                    set, fn);
71
30
  ctx = FN(MULTI(BASE),get_ctx)(multi);
72
30
  if (!isl_space_has_named_params(multi->space) ||
73
30
      !isl_space_has_named_params(set->dim))
74
30
    
isl_die0
(ctx, isl_error_invalid,
75
30
      "unaligned unnamed parameters", goto error);
76
30
  multi = FN(MULTI(BASE),align_params)(multi,
77
30
            FN(APPLY_DOM,get_space)(set));
78
30
  set = FN(APPLY_DOM,align_params)(set, FN(MULTI(BASE),get_space)(multi));
79
30
  return FN(FN(MULTI(BASE),apply_aligned),APPLY_DOMBASE)(multi, set, fn);
80
30
error:
81
0
  FN(MULTI(BASE),free)(multi);
82
0
  FN(APPLY_DOM,free)(set);
83
0
  return NULL;
84
30
}
isl_aff.c:isl_multi_aff_apply_set
Line
Count
Source
58
862
{
59
862
  isl_bool aligned;
60
862
  isl_ctx *ctx;
61
862
62
862
  if (!multi || !set)
63
0
    goto error;
64
862
65
862
  aligned = FN(APPLY_DOM,space_has_equal_params)(set, multi->space);
66
862
  if (aligned < 0)
67
0
    goto error;
68
862
  if (aligned)
69
862
    return FN(FN(MULTI(BASE),apply_aligned),APPLY_DOMBASE)(multi,
70
862
                    set, fn);
71
0
  ctx = FN(MULTI(BASE),get_ctx)(multi);
72
0
  if (!isl_space_has_named_params(multi->space) ||
73
0
      !isl_space_has_named_params(set->dim))
74
0
    isl_die(ctx, isl_error_invalid,
75
0
      "unaligned unnamed parameters", goto error);
76
0
  multi = FN(MULTI(BASE),align_params)(multi,
77
0
            FN(APPLY_DOM,get_space)(set));
78
0
  set = FN(APPLY_DOM,align_params)(set, FN(MULTI(BASE),get_space)(multi));
79
0
  return FN(FN(MULTI(BASE),apply_aligned),APPLY_DOMBASE)(multi, set, fn);
80
0
error:
81
0
  FN(MULTI(BASE),free)(multi);
82
0
  FN(APPLY_DOM,free)(set);
83
0
  return NULL;
84
0
}
isl_aff.c:isl_multi_pw_aff_apply_set
Line
Count
Source
58
88
{
59
88
  isl_bool aligned;
60
88
  isl_ctx *ctx;
61
88
62
88
  if (!multi || !set)
63
0
    goto error;
64
88
65
88
  aligned = FN(APPLY_DOM,space_has_equal_params)(set, multi->space);
66
88
  if (aligned < 0)
67
0
    goto error;
68
88
  if (aligned)
69
88
    return FN(FN(MULTI(BASE),apply_aligned),APPLY_DOMBASE)(multi,
70
88
                    set, fn);
71
0
  ctx = FN(MULTI(BASE),get_ctx)(multi);
72
0
  if (!isl_space_has_named_params(multi->space) ||
73
0
      !isl_space_has_named_params(set->dim))
74
0
    isl_die(ctx, isl_error_invalid,
75
0
      "unaligned unnamed parameters", goto error);
76
0
  multi = FN(MULTI(BASE),align_params)(multi,
77
0
            FN(APPLY_DOM,get_space)(set));
78
0
  set = FN(APPLY_DOM,align_params)(set, FN(MULTI(BASE),get_space)(multi));
79
0
  return FN(FN(MULTI(BASE),apply_aligned),APPLY_DOMBASE)(multi, set, fn);
80
0
error:
81
0
  FN(MULTI(BASE),free)(multi);
82
0
  FN(APPLY_DOM,free)(set);
83
0
  return NULL;
84
0
}
isl_aff.c:isl_multi_union_pw_aff_apply_union_set
Line
Count
Source
58
169
{
59
169
  isl_bool aligned;
60
169
  isl_ctx *ctx;
61
169
62
169
  if (!multi || !set)
63
0
    goto error;
64
169
65
169
  aligned = FN(APPLY_DOM,space_has_equal_params)(set, multi->space);
66
169
  if (aligned < 0)
67
0
    goto error;
68
169
  if (aligned)
69
141
    return FN(FN(MULTI(BASE),apply_aligned),APPLY_DOMBASE)(multi,
70
141
                    set, fn);
71
28
  ctx = FN(MULTI(BASE),get_ctx)(multi);
72
28
  if (!isl_space_has_named_params(multi->space) ||
73
28
      !isl_space_has_named_params(set->dim))
74
28
    
isl_die0
(ctx, isl_error_invalid,
75
28
      "unaligned unnamed parameters", goto error);
76
28
  multi = FN(MULTI(BASE),align_params)(multi,
77
28
            FN(APPLY_DOM,get_space)(set));
78
28
  set = FN(APPLY_DOM,align_params)(set, FN(MULTI(BASE),get_space)(multi));
79
28
  return FN(FN(MULTI(BASE),apply_aligned),APPLY_DOMBASE)(multi, set, fn);
80
28
error:
81
0
  FN(MULTI(BASE),free)(multi);
82
0
  FN(APPLY_DOM,free)(set);
83
0
  return NULL;
84
28
}
isl_aff.c:isl_multi_union_pw_aff_apply_set
Line
Count
Source
58
407
{
59
407
  isl_bool aligned;
60
407
  isl_ctx *ctx;
61
407
62
407
  if (!multi || !set)
63
0
    goto error;
64
407
65
407
  aligned = FN(APPLY_DOM,space_has_equal_params)(set, multi->space);
66
407
  if (aligned < 0)
67
0
    goto error;
68
407
  if (aligned)
69
405
    return FN(FN(MULTI(BASE),apply_aligned),APPLY_DOMBASE)(multi,
70
405
                    set, fn);
71
2
  ctx = FN(MULTI(BASE),get_ctx)(multi);
72
2
  if (!isl_space_has_named_params(multi->space) ||
73
2
      !isl_space_has_named_params(set->dim))
74
2
    
isl_die0
(ctx, isl_error_invalid,
75
2
      "unaligned unnamed parameters", goto error);
76
2
  multi = FN(MULTI(BASE),align_params)(multi,
77
2
            FN(APPLY_DOM,get_space)(set));
78
2
  set = FN(APPLY_DOM,align_params)(set, FN(MULTI(BASE),get_space)(multi));
79
2
  return FN(FN(MULTI(BASE),apply_aligned),APPLY_DOMBASE)(multi, set, fn);
80
2
error:
81
0
  FN(MULTI(BASE),free)(multi);
82
0
  FN(APPLY_DOM,free)(set);
83
0
  return NULL;
84
2
}