Coverage Report

Created: 2018-04-24 22:41

/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.58k
{
22
4.58k
  int i;
23
4.58k
24
4.58k
  if (!multi || !set)
25
0
    goto error;
26
4.58k
27
4.58k
  if (multi->n == 0) {
28
51
    FN(APPLY_DOM,free)(set);
29
51
    return multi;
30
51
  }
31
4.52k
32
4.52k
  multi = FN(MULTI(BASE),cow)(multi);
33
4.52k
  if (!multi)
34
0
    goto error;
35
4.52k
36
12.8k
  
for (i = 0; 4.52k
i < multi->n;
++i8.30k
) {
37
8.30k
    multi->u.p[i] = fn(multi->u.p[i], FN(APPLY_DOM,copy)(set));
38
8.30k
    if (!multi->u.p[i])
39
0
      goto error;
40
8.30k
  }
41
4.52k
42
4.52k
  FN(APPLY_DOM,free)(set);
43
4.52k
  return multi;
44
4.52k
error:
45
0
  FN(APPLY_DOM,free)(set);
46
0
  FN(MULTI(BASE),free)(multi);
47
0
  return NULL;
48
4.52k
}
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
51
    FN(APPLY_DOM,free)(set);
29
51
    return multi;
30
51
  }
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.36k
  
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
86
{
22
86
  int i;
23
86
24
86
  if (!multi || !set)
25
0
    goto error;
26
86
27
86
  if (multi->n == 0) {
28
0
    FN(APPLY_DOM,free)(set);
29
0
    return multi;
30
0
  }
31
86
32
86
  multi = FN(MULTI(BASE),cow)(multi);
33
86
  if (!multi)
34
0
    goto error;
35
86
36
197
  
for (i = 0; 86
i < multi->n;
++i111
) {
37
111
    multi->u.p[i] = fn(multi->u.p[i], FN(APPLY_DOM,copy)(set));
38
111
    if (!multi->u.p[i])
39
0
      goto error;
40
111
  }
41
86
42
86
  FN(APPLY_DOM,free)(set);
43
86
  return multi;
44
86
error:
45
0
  FN(APPLY_DOM,free)(set);
46
0
  FN(MULTI(BASE),free)(multi);
47
0
  return NULL;
48
86
}
isl_multi_union_pw_aff_apply_aligned_set
Line
Count
Source
21
3
{
22
3
  int i;
23
3
24
3
  if (!multi || !set)
25
0
    goto error;
26
3
27
3
  if (multi->n == 0) {
28
0
    FN(APPLY_DOM,free)(set);
29
0
    return multi;
30
0
  }
31
3
32
3
  multi = FN(MULTI(BASE),cow)(multi);
33
3
  if (!multi)
34
0
    goto error;
35
3
36
6
  
for (i = 0; 3
i < multi->n;
++i3
) {
37
3
    multi->u.p[i] = fn(multi->u.p[i], FN(APPLY_DOM,copy)(set));
38
3
    if (!multi->u.p[i])
39
0
      goto error;
40
3
  }
41
3
42
3
  FN(APPLY_DOM,free)(set);
43
3
  return multi;
44
3
error:
45
0
  FN(APPLY_DOM,free)(set);
46
0
  FN(MULTI(BASE),free)(multi);
47
0
  return NULL;
48
3
}
isl_multi_union_pw_aff_apply_aligned_union_set
Line
Count
Source
21
1.62k
{
22
1.62k
  int i;
23
1.62k
24
1.62k
  if (!multi || !set)
25
0
    goto error;
26
1.62k
27
1.62k
  if (multi->n == 0) {
28
0
    FN(APPLY_DOM,free)(set);
29
0
    return multi;
30
0
  }
31
1.62k
32
1.62k
  multi = FN(MULTI(BASE),cow)(multi);
33
1.62k
  if (!multi)
34
0
    goto error;
35
1.62k
36
3.26k
  
for (i = 0; 1.62k
i < multi->n;
++i1.63k
) {
37
1.63k
    multi->u.p[i] = fn(multi->u.p[i], FN(APPLY_DOM,copy)(set));
38
1.63k
    if (!multi->u.p[i])
39
0
      goto error;
40
1.63k
  }
41
1.62k
42
1.62k
  FN(APPLY_DOM,free)(set);
43
1.62k
  return multi;
44
1.62k
error:
45
0
  FN(APPLY_DOM,free)(set);
46
0
  FN(MULTI(BASE),free)(multi);
47
0
  return NULL;
48
1.62k
}
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.58k
{
59
4.58k
  isl_bool aligned;
60
4.58k
  isl_ctx *ctx;
61
4.58k
62
4.58k
  if (!multi || !set)
63
0
    goto error;
64
4.58k
65
4.58k
  aligned = FN(APPLY_DOM,space_has_equal_params)(set, multi->space);
66
4.58k
  if (aligned < 0)
67
0
    goto error;
68
4.58k
  if (aligned)
69
4.49k
    return FN(FN(MULTI(BASE),apply_aligned),APPLY_DOMBASE)(multi,
70
4.49k
                    set, fn);
71
81
  ctx = FN(MULTI(BASE),get_ctx)(multi);
72
81
  if (!isl_space_has_named_params(multi->space) ||
73
81
      !isl_space_has_named_params(set->dim))
74
81
    
isl_die0
(ctx, isl_error_invalid,
75
81
      "unaligned unnamed parameters", goto error);
76
81
  multi = FN(MULTI(BASE),align_params)(multi,
77
81
            FN(APPLY_DOM,get_space)(set));
78
81
  set = FN(APPLY_DOM,align_params)(set, FN(MULTI(BASE),get_space)(multi));
79
81
  return FN(FN(MULTI(BASE),apply_aligned),APPLY_DOMBASE)(multi, set, fn);
80
81
error:
81
0
  FN(MULTI(BASE),free)(multi);
82
0
  FN(APPLY_DOM,free)(set);
83
0
  return NULL;
84
81
}
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
86
{
59
86
  isl_bool aligned;
60
86
  isl_ctx *ctx;
61
86
62
86
  if (!multi || !set)
63
0
    goto error;
64
86
65
86
  aligned = FN(APPLY_DOM,space_has_equal_params)(set, multi->space);
66
86
  if (aligned < 0)
67
0
    goto error;
68
86
  if (aligned)
69
86
    return FN(FN(MULTI(BASE),apply_aligned),APPLY_DOMBASE)(multi,
70
86
                    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
1.62k
{
59
1.62k
  isl_bool aligned;
60
1.62k
  isl_ctx *ctx;
61
1.62k
62
1.62k
  if (!multi || !set)
63
0
    goto error;
64
1.62k
65
1.62k
  aligned = FN(APPLY_DOM,space_has_equal_params)(set, multi->space);
66
1.62k
  if (aligned < 0)
67
0
    goto error;
68
1.62k
  if (aligned)
69
1.55k
    return FN(FN(MULTI(BASE),apply_aligned),APPLY_DOMBASE)(multi,
70
1.55k
                    set, fn);
71
79
  ctx = FN(MULTI(BASE),get_ctx)(multi);
72
79
  if (!isl_space_has_named_params(multi->space) ||
73
79
      !isl_space_has_named_params(set->dim))
74
79
    
isl_die0
(ctx, isl_error_invalid,
75
79
      "unaligned unnamed parameters", goto error);
76
79
  multi = FN(MULTI(BASE),align_params)(multi,
77
79
            FN(APPLY_DOM,get_space)(set));
78
79
  set = FN(APPLY_DOM,align_params)(set, FN(MULTI(BASE),get_space)(multi));
79
79
  return FN(FN(MULTI(BASE),apply_aligned),APPLY_DOMBASE)(multi, set, fn);
80
79
error:
81
0
  FN(MULTI(BASE),free)(multi);
82
0
  FN(APPLY_DOM,free)(set);
83
0
  return NULL;
84
79
}
isl_aff.c:isl_multi_union_pw_aff_apply_set
Line
Count
Source
58
3
{
59
3
  isl_bool aligned;
60
3
  isl_ctx *ctx;
61
3
62
3
  if (!multi || !set)
63
0
    goto error;
64
3
65
3
  aligned = FN(APPLY_DOM,space_has_equal_params)(set, multi->space);
66
3
  if (aligned < 0)
67
0
    goto error;
68
3
  if (aligned)
69
1
    return FN(FN(MULTI(BASE),apply_aligned),APPLY_DOMBASE)(multi,
70
1
                    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
}