Coverage Report

Created: 2018-06-19 22:08

/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
4.59k
{
22
4.59k
  int i;
23
4.59k
24
4.59k
  if (!multi || !set)
25
0
    goto error;
26
4.59k
27
4.59k
  if (multi->n == 0) {
28
47
    FN(APPLY_DOM,free)(set);
29
47
    return multi;
30
47
  }
31
4.54k
32
4.54k
  multi = FN(MULTI(BASE),cow)(multi);
33
4.54k
  if (!multi)
34
0
    goto error;
35
4.54k
36
12.8k
  
for (i = 0; 4.54k
i < multi->n;
++i8.31k
) {
37
8.31k
    multi->u.p[i] = fn(multi->u.p[i], FN(APPLY_DOM,copy)(set));
38
8.31k
    if (!multi->u.p[i])
39
0
      goto error;
40
8.31k
  }
41
4.54k
42
4.54k
  FN(APPLY_DOM,free)(set);
43
4.54k
  return multi;
44
4.54k
error:
45
0
  FN(APPLY_DOM,free)(set);
46
0
  FN(MULTI(BASE),free)(multi);
47
0
  return NULL;
48
4.54k
}
isl_multi_aff_apply_aligned_set
Line
Count
Source
21
2.86k
{
22
2.86k
  int i;
23
2.86k
24
2.86k
  if (!multi || !set)
25
0
    goto error;
26
2.86k
27
2.86k
  if (multi->n == 0) {
28
47
    FN(APPLY_DOM,free)(set);
29
47
    return multi;
30
47
  }
31
2.81k
32
2.81k
  multi = FN(MULTI(BASE),cow)(multi);
33
2.81k
  if (!multi)
34
0
    goto error;
35
2.81k
36
9.37k
  
for (i = 0; 2.81k
i < multi->n;
++i6.55k
) {
37
6.55k
    multi->u.p[i] = fn(multi->u.p[i], FN(APPLY_DOM,copy)(set));
38
6.55k
    if (!multi->u.p[i])
39
0
      goto error;
40
6.55k
  }
41
2.81k
42
2.81k
  FN(APPLY_DOM,free)(set);
43
2.81k
  return multi;
44
2.81k
error:
45
0
  FN(APPLY_DOM,free)(set);
46
0
  FN(MULTI(BASE),free)(multi);
47
0
  return NULL;
48
2.81k
}
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
1.31k
{
22
1.31k
  int i;
23
1.31k
24
1.31k
  if (!multi || !set)
25
0
    goto error;
26
1.31k
27
1.31k
  if (multi->n == 0) {
28
0
    FN(APPLY_DOM,free)(set);
29
0
    return multi;
30
0
  }
31
1.31k
32
1.31k
  multi = FN(MULTI(BASE),cow)(multi);
33
1.31k
  if (!multi)
34
0
    goto error;
35
1.31k
36
2.62k
  
for (i = 0; 1.31k
i < multi->n;
++i1.31k
) {
37
1.31k
    multi->u.p[i] = fn(multi->u.p[i], FN(APPLY_DOM,copy)(set));
38
1.31k
    if (!multi->u.p[i])
39
0
      goto error;
40
1.31k
  }
41
1.31k
42
1.31k
  FN(APPLY_DOM,free)(set);
43
1.31k
  return multi;
44
1.31k
error:
45
0
  FN(APPLY_DOM,free)(set);
46
0
  FN(MULTI(BASE),free)(multi);
47
0
  return NULL;
48
1.31k
}
isl_multi_union_pw_aff_apply_aligned_union_set
Line
Count
Source
21
327
{
22
327
  int i;
23
327
24
327
  if (!multi || !set)
25
0
    goto error;
26
327
27
327
  if (multi->n == 0) {
28
0
    FN(APPLY_DOM,free)(set);
29
0
    return multi;
30
0
  }
31
327
32
327
  multi = FN(MULTI(BASE),cow)(multi);
33
327
  if (!multi)
34
0
    goto error;
35
327
36
662
  
for (i = 0; 327
i < multi->n;
++i335
) {
37
335
    multi->u.p[i] = fn(multi->u.p[i], FN(APPLY_DOM,copy)(set));
38
335
    if (!multi->u.p[i])
39
0
      goto error;
40
335
  }
41
327
42
327
  FN(APPLY_DOM,free)(set);
43
327
  return multi;
44
327
error:
45
0
  FN(APPLY_DOM,free)(set);
46
0
  FN(MULTI(BASE),free)(multi);
47
0
  return NULL;
48
327
}
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
4.59k
{
59
4.59k
  isl_bool aligned;
60
4.59k
  isl_ctx *ctx;
61
4.59k
62
4.59k
  if (!multi || !set)
63
0
    goto error;
64
4.59k
65
4.59k
  aligned = FN(APPLY_DOM,space_has_equal_params)(set, multi->space);
66
4.59k
  if (aligned < 0)
67
0
    goto error;
68
4.59k
  if (aligned)
69
4.50k
    return FN(FN(MULTI(BASE),apply_aligned),APPLY_DOMBASE)(multi,
70
4.50k
                    set, fn);
71
85
  ctx = FN(MULTI(BASE),get_ctx)(multi);
72
85
  if (!isl_space_has_named_params(multi->space) ||
73
85
      !isl_space_has_named_params(set->dim))
74
85
    
isl_die0
(ctx, isl_error_invalid,
75
85
      "unaligned unnamed parameters", goto error);
76
85
  multi = FN(MULTI(BASE),align_params)(multi,
77
85
            FN(APPLY_DOM,get_space)(set));
78
85
  set = FN(APPLY_DOM,align_params)(set, FN(MULTI(BASE),get_space)(multi));
79
85
  return FN(FN(MULTI(BASE),apply_aligned),APPLY_DOMBASE)(multi, set, fn);
80
85
error:
81
0
  FN(MULTI(BASE),free)(multi);
82
0
  FN(APPLY_DOM,free)(set);
83
0
  return NULL;
84
85
}
isl_aff.c:isl_multi_aff_apply_set
Line
Count
Source
58
2.86k
{
59
2.86k
  isl_bool aligned;
60
2.86k
  isl_ctx *ctx;
61
2.86k
62
2.86k
  if (!multi || !set)
63
0
    goto error;
64
2.86k
65
2.86k
  aligned = FN(APPLY_DOM,space_has_equal_params)(set, multi->space);
66
2.86k
  if (aligned < 0)
67
0
    goto error;
68
2.86k
  if (aligned)
69
2.86k
    return FN(FN(MULTI(BASE),apply_aligned),APPLY_DOMBASE)(multi,
70
2.86k
                    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
327
{
59
327
  isl_bool aligned;
60
327
  isl_ctx *ctx;
61
327
62
327
  if (!multi || !set)
63
0
    goto error;
64
327
65
327
  aligned = FN(APPLY_DOM,space_has_equal_params)(set, multi->space);
66
327
  if (aligned < 0)
67
0
    goto error;
68
327
  if (aligned)
69
244
    return FN(FN(MULTI(BASE),apply_aligned),APPLY_DOMBASE)(multi,
70
244
                    set, fn);
71
83
  ctx = FN(MULTI(BASE),get_ctx)(multi);
72
83
  if (!isl_space_has_named_params(multi->space) ||
73
83
      !isl_space_has_named_params(set->dim))
74
83
    
isl_die0
(ctx, isl_error_invalid,
75
83
      "unaligned unnamed parameters", goto error);
76
83
  multi = FN(MULTI(BASE),align_params)(multi,
77
83
            FN(APPLY_DOM,get_space)(set));
78
83
  set = FN(APPLY_DOM,align_params)(set, FN(MULTI(BASE),get_space)(multi));
79
83
  return FN(FN(MULTI(BASE),apply_aligned),APPLY_DOMBASE)(multi, set, fn);
80
83
error:
81
0
  FN(MULTI(BASE),free)(multi);
82
0
  FN(APPLY_DOM,free)(set);
83
0
  return NULL;
84
83
}
isl_aff.c:isl_multi_union_pw_aff_apply_set
Line
Count
Source
58
1.31k
{
59
1.31k
  isl_bool aligned;
60
1.31k
  isl_ctx *ctx;
61
1.31k
62
1.31k
  if (!multi || !set)
63
0
    goto error;
64
1.31k
65
1.31k
  aligned = FN(APPLY_DOM,space_has_equal_params)(set, multi->space);
66
1.31k
  if (aligned < 0)
67
0
    goto error;
68
1.31k
  if (aligned)
69
1.30k
    return FN(FN(MULTI(BASE),apply_aligned),APPLY_DOMBASE)(multi,
70
1.30k
                    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
}