Coverage Report

Created: 2018-12-13 20:48

/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.62k
{
22
4.62k
  int i;
23
4.62k
24
4.62k
  if (!multi || !set)
25
0
    goto error;
26
4.62k
27
4.62k
  if (multi->n == 0) {
28
48
    FN(APPLY_DOM,free)(set);
29
48
    return multi;
30
48
  }
31
4.57k
32
4.57k
  multi = FN(MULTI(BASE),cow)(multi);
33
4.57k
  if (!multi)
34
0
    goto error;
35
4.57k
36
12.9k
  
for (i = 0; 4.57k
i < multi->n;
++i8.39k
) {
37
8.39k
    multi->u.p[i] = fn(multi->u.p[i], FN(APPLY_DOM,copy)(set));
38
8.39k
    if (!multi->u.p[i])
39
0
      goto error;
40
8.39k
  }
41
4.57k
42
4.57k
  FN(APPLY_DOM,free)(set);
43
4.57k
  return multi;
44
4.57k
error:
45
0
  FN(APPLY_DOM,free)(set);
46
0
  FN(MULTI(BASE),free)(multi);
47
0
  return NULL;
48
4.57k
}
isl_multi_aff_apply_aligned_set
Line
Count
Source
21
2.88k
{
22
2.88k
  int i;
23
2.88k
24
2.88k
  if (!multi || !set)
25
0
    goto error;
26
2.88k
27
2.88k
  if (multi->n == 0) {
28
48
    FN(APPLY_DOM,free)(set);
29
48
    return multi;
30
48
  }
31
2.84k
32
2.84k
  multi = FN(MULTI(BASE),cow)(multi);
33
2.84k
  if (!multi)
34
0
    goto error;
35
2.84k
36
9.46k
  
for (i = 0; 2.84k
i < multi->n;
++i6.62k
) {
37
6.62k
    multi->u.p[i] = fn(multi->u.p[i], FN(APPLY_DOM,copy)(set));
38
6.62k
    if (!multi->u.p[i])
39
0
      goto error;
40
6.62k
  }
41
2.84k
42
2.84k
  FN(APPLY_DOM,free)(set);
43
2.84k
  return multi;
44
2.84k
error:
45
0
  FN(APPLY_DOM,free)(set);
46
0
  FN(MULTI(BASE),free)(multi);
47
0
  return NULL;
48
2.84k
}
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
336
{
22
336
  int i;
23
336
24
336
  if (!multi || !set)
25
0
    goto error;
26
336
27
336
  if (multi->n == 0) {
28
0
    FN(APPLY_DOM,free)(set);
29
0
    return multi;
30
0
  }
31
336
32
336
  multi = FN(MULTI(BASE),cow)(multi);
33
336
  if (!multi)
34
0
    goto error;
35
336
36
680
  
for (i = 0; 336
i < multi->n;
++i344
) {
37
344
    multi->u.p[i] = fn(multi->u.p[i], FN(APPLY_DOM,copy)(set));
38
344
    if (!multi->u.p[i])
39
0
      goto error;
40
344
  }
41
336
42
336
  FN(APPLY_DOM,free)(set);
43
336
  return multi;
44
336
error:
45
0
  FN(APPLY_DOM,free)(set);
46
0
  FN(MULTI(BASE),free)(multi);
47
0
  return NULL;
48
336
}
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.62k
{
59
4.62k
  isl_bool aligned;
60
4.62k
  isl_ctx *ctx;
61
4.62k
62
4.62k
  if (!multi || !set)
63
0
    goto error;
64
4.62k
65
4.62k
  aligned = FN(APPLY_DOM,space_has_equal_params)(set, multi->space);
66
4.62k
  if (aligned < 0)
67
0
    goto error;
68
4.62k
  if (aligned)
69
4.52k
    return FN(FN(MULTI(BASE),apply_aligned),APPLY_DOMBASE)(multi,
70
4.52k
                    set, fn);
71
94
  ctx = FN(MULTI(BASE),get_ctx)(multi);
72
94
  if (!isl_space_has_named_params(multi->space) ||
73
94
      !isl_space_has_named_params(set->dim))
74
94
    
isl_die0
(ctx, isl_error_invalid,
75
94
      "unaligned unnamed parameters", goto error);
76
94
  multi = FN(MULTI(BASE),align_params)(multi,
77
94
            FN(APPLY_DOM,get_space)(set));
78
94
  set = FN(APPLY_DOM,align_params)(set, FN(MULTI(BASE),get_space)(multi));
79
94
  return FN(FN(MULTI(BASE),apply_aligned),APPLY_DOMBASE)(multi, set, fn);
80
94
error:
81
0
  FN(MULTI(BASE),free)(multi);
82
0
  FN(APPLY_DOM,free)(set);
83
0
  return NULL;
84
94
}
isl_aff.c:isl_multi_aff_apply_set
Line
Count
Source
58
2.88k
{
59
2.88k
  isl_bool aligned;
60
2.88k
  isl_ctx *ctx;
61
2.88k
62
2.88k
  if (!multi || !set)
63
0
    goto error;
64
2.88k
65
2.88k
  aligned = FN(APPLY_DOM,space_has_equal_params)(set, multi->space);
66
2.88k
  if (aligned < 0)
67
0
    goto error;
68
2.88k
  if (aligned)
69
2.88k
    return FN(FN(MULTI(BASE),apply_aligned),APPLY_DOMBASE)(multi,
70
2.88k
                    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
336
{
59
336
  isl_bool aligned;
60
336
  isl_ctx *ctx;
61
336
62
336
  if (!multi || !set)
63
0
    goto error;
64
336
65
336
  aligned = FN(APPLY_DOM,space_has_equal_params)(set, multi->space);
66
336
  if (aligned < 0)
67
0
    goto error;
68
336
  if (aligned)
69
244
    return FN(FN(MULTI(BASE),apply_aligned),APPLY_DOMBASE)(multi,
70
244
                    set, fn);
71
92
  ctx = FN(MULTI(BASE),get_ctx)(multi);
72
92
  if (!isl_space_has_named_params(multi->space) ||
73
92
      !isl_space_has_named_params(set->dim))
74
92
    
isl_die0
(ctx, isl_error_invalid,
75
92
      "unaligned unnamed parameters", goto error);
76
92
  multi = FN(MULTI(BASE),align_params)(multi,
77
92
            FN(APPLY_DOM,get_space)(set));
78
92
  set = FN(APPLY_DOM,align_params)(set, FN(MULTI(BASE),get_space)(multi));
79
92
  return FN(FN(MULTI(BASE),apply_aligned),APPLY_DOMBASE)(multi, set, fn);
80
92
error:
81
0
  FN(MULTI(BASE),free)(multi);
82
0
  FN(APPLY_DOM,free)(set);
83
0
  return NULL;
84
92
}
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
}