Coverage Report

Created: 2019-07-24 05:18

/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.77k
{
22
4.77k
  int i;
23
4.77k
24
4.77k
  if (!multi || !set)
25
0
    goto error;
26
4.77k
27
4.77k
  if (multi->n == 0) {
28
47
    FN(APPLY_DOM,free)(set);
29
47
    return multi;
30
47
  }
31
4.72k
32
4.72k
  multi = FN(MULTI(BASE),cow)(multi);
33
4.72k
  if (!multi)
34
0
    goto error;
35
4.72k
36
13.7k
  
for (i = 0; 4.72k
i < multi->n;
++i9.00k
) {
37
9.00k
    multi->u.p[i] = fn(multi->u.p[i], FN(APPLY_DOM,copy)(set));
38
9.00k
    if (!multi->u.p[i])
39
0
      goto error;
40
9.00k
  }
41
4.72k
42
4.72k
  FN(APPLY_DOM,free)(set);
43
4.72k
  return multi;
44
4.72k
error:
45
0
  FN(APPLY_DOM,free)(set);
46
0
  FN(MULTI(BASE),free)(multi);
47
0
  return NULL;
48
4.72k
}
isl_multi_aff_apply_aligned_set
Line
Count
Source
21
3.02k
{
22
3.02k
  int i;
23
3.02k
24
3.02k
  if (!multi || !set)
25
0
    goto error;
26
3.02k
27
3.02k
  if (multi->n == 0) {
28
47
    FN(APPLY_DOM,free)(set);
29
47
    return multi;
30
47
  }
31
2.97k
32
2.97k
  multi = FN(MULTI(BASE),cow)(multi);
33
2.97k
  if (!multi)
34
0
    goto error;
35
2.97k
36
10.1k
  
for (i = 0; 2.97k
i < multi->n;
++i7.21k
) {
37
7.21k
    multi->u.p[i] = fn(multi->u.p[i], FN(APPLY_DOM,copy)(set));
38
7.21k
    if (!multi->u.p[i])
39
0
      goto error;
40
7.21k
  }
41
2.97k
42
2.97k
  FN(APPLY_DOM,free)(set);
43
2.97k
  return multi;
44
2.97k
error:
45
0
  FN(APPLY_DOM,free)(set);
46
0
  FN(MULTI(BASE),free)(multi);
47
0
  return NULL;
48
2.97k
}
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.63k
  
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
344
{
22
344
  int i;
23
344
24
344
  if (!multi || !set)
25
0
    goto error;
26
344
27
344
  if (multi->n == 0) {
28
0
    FN(APPLY_DOM,free)(set);
29
0
    return multi;
30
0
  }
31
344
32
344
  multi = FN(MULTI(BASE),cow)(multi);
33
344
  if (!multi)
34
0
    goto error;
35
344
36
696
  
for (i = 0; 344
i < multi->n;
++i352
) {
37
352
    multi->u.p[i] = fn(multi->u.p[i], FN(APPLY_DOM,copy)(set));
38
352
    if (!multi->u.p[i])
39
0
      goto error;
40
352
  }
41
344
42
344
  FN(APPLY_DOM,free)(set);
43
344
  return multi;
44
344
error:
45
0
  FN(APPLY_DOM,free)(set);
46
0
  FN(MULTI(BASE),free)(multi);
47
0
  return NULL;
48
344
}
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.77k
{
59
4.77k
  isl_bool aligned;
60
4.77k
  isl_ctx *ctx;
61
4.77k
62
4.77k
  if (!multi || !set)
63
0
    goto error;
64
4.77k
65
4.77k
  aligned = FN(APPLY_DOM,space_has_equal_params)(set, multi->space);
66
4.77k
  if (aligned < 0)
67
0
    goto error;
68
4.77k
  if (aligned)
69
4.68k
    return FN(FN(MULTI(BASE),apply_aligned),APPLY_DOMBASE)(multi,
70
4.68k
                    set, fn);
71
95
  ctx = FN(MULTI(BASE),get_ctx)(multi);
72
95
  if (!isl_space_has_named_params(multi->space) ||
73
95
      !isl_space_has_named_params(set->dim))
74
95
    
isl_die0
(ctx, isl_error_invalid,
75
95
      "unaligned unnamed parameters", goto error);
76
95
  multi = FN(MULTI(BASE),align_params)(multi,
77
95
            FN(APPLY_DOM,get_space)(set));
78
95
  set = FN(APPLY_DOM,align_params)(set, FN(MULTI(BASE),get_space)(multi));
79
95
  return FN(FN(MULTI(BASE),apply_aligned),APPLY_DOMBASE)(multi, set, fn);
80
95
error:
81
0
  FN(MULTI(BASE),free)(multi);
82
0
  FN(APPLY_DOM,free)(set);
83
0
  return NULL;
84
95
}
isl_aff.c:isl_multi_aff_apply_set
Line
Count
Source
58
3.02k
{
59
3.02k
  isl_bool aligned;
60
3.02k
  isl_ctx *ctx;
61
3.02k
62
3.02k
  if (!multi || !set)
63
0
    goto error;
64
3.02k
65
3.02k
  aligned = FN(APPLY_DOM,space_has_equal_params)(set, multi->space);
66
3.02k
  if (aligned < 0)
67
0
    goto error;
68
3.02k
  if (aligned)
69
3.02k
    return FN(FN(MULTI(BASE),apply_aligned),APPLY_DOMBASE)(multi,
70
3.02k
                    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
344
{
59
344
  isl_bool aligned;
60
344
  isl_ctx *ctx;
61
344
62
344
  if (!multi || !set)
63
0
    goto error;
64
344
65
344
  aligned = FN(APPLY_DOM,space_has_equal_params)(set, multi->space);
66
344
  if (aligned < 0)
67
0
    goto error;
68
344
  if (aligned)
69
251
    return FN(FN(MULTI(BASE),apply_aligned),APPLY_DOMBASE)(multi,
70
251
                    set, fn);
71
93
  ctx = FN(MULTI(BASE),get_ctx)(multi);
72
93
  if (!isl_space_has_named_params(multi->space) ||
73
93
      !isl_space_has_named_params(set->dim))
74
93
    
isl_die0
(ctx, isl_error_invalid,
75
93
      "unaligned unnamed parameters", goto error);
76
93
  multi = FN(MULTI(BASE),align_params)(multi,
77
93
            FN(APPLY_DOM,get_space)(set));
78
93
  set = FN(APPLY_DOM,align_params)(set, FN(MULTI(BASE),get_space)(multi));
79
93
  return FN(FN(MULTI(BASE),apply_aligned),APPLY_DOMBASE)(multi, set, fn);
80
93
error:
81
0
  FN(MULTI(BASE),free)(multi);
82
0
  FN(APPLY_DOM,free)(set);
83
0
  return NULL;
84
93
}
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.31k
    return FN(FN(MULTI(BASE),apply_aligned),APPLY_DOMBASE)(multi,
70
1.31k
                    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
}