Coverage Report

Created: 2018-12-09 11:54

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/tools/polly/lib/External/isl/isl_multi_intersect.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
/* Does the space of "domain" correspond to that of the domain of "multi"?
14
 * The parameters do not need to be aligned.
15
 */
16
static isl_bool FN(MULTI(BASE),compatible_domain)(
17
  __isl_keep MULTI(BASE) *multi, __isl_keep DOM *domain)
18
318
{
19
318
  isl_bool ok;
20
318
  isl_space *space, *domain_space;
21
318
22
318
  domain_space = FN(DOM,get_space)(domain);
23
318
  space = FN(MULTI(BASE),get_space)(multi);
24
318
  ok = isl_space_has_domain_tuples(domain_space, space);
25
318
  isl_space_free(space);
26
318
  isl_space_free(domain_space);
27
318
28
318
  return ok;
29
318
}
isl_aff.c:isl_multi_pw_aff_compatible_domain
Line
Count
Source
18
168
{
19
168
  isl_bool ok;
20
168
  isl_space *space, *domain_space;
21
168
22
168
  domain_space = FN(DOM,get_space)(domain);
23
168
  space = FN(MULTI(BASE),get_space)(multi);
24
168
  ok = isl_space_has_domain_tuples(domain_space, space);
25
168
  isl_space_free(space);
26
168
  isl_space_free(domain_space);
27
168
28
168
  return ok;
29
168
}
isl_aff.c:isl_multi_union_pw_aff_compatible_domain
Line
Count
Source
18
150
{
19
150
  isl_bool ok;
20
150
  isl_space *space, *domain_space;
21
150
22
150
  domain_space = FN(DOM,get_space)(domain);
23
150
  space = FN(MULTI(BASE),get_space)(multi);
24
150
  ok = isl_space_has_domain_tuples(domain_space, space);
25
150
  isl_space_free(space);
26
150
  isl_space_free(domain_space);
27
150
28
150
  return ok;
29
150
}
30
31
/* Check that the space of "domain" corresponds to
32
 * that of the domain of "multi", ignoring parameters.
33
 */
34
static isl_stat FN(MULTI(BASE),check_compatible_domain)(
35
  __isl_keep MULTI(BASE) *multi, __isl_keep DOM *domain)
36
318
{
37
318
  isl_bool ok;
38
318
39
318
  ok = FN(MULTI(BASE),compatible_domain)(multi, domain);
40
318
  if (ok < 0)
41
0
    return isl_stat_error;
42
318
  if (!ok)
43
318
    
isl_die0
(FN(DOM,get_ctx)(domain), isl_error_invalid,
44
318
      "incompatible spaces", return isl_stat_error);
45
318
46
318
  return isl_stat_ok;
47
318
}
isl_aff.c:isl_multi_pw_aff_check_compatible_domain
Line
Count
Source
36
168
{
37
168
  isl_bool ok;
38
168
39
168
  ok = FN(MULTI(BASE),compatible_domain)(multi, domain);
40
168
  if (ok < 0)
41
0
    return isl_stat_error;
42
168
  if (!ok)
43
168
    
isl_die0
(FN(DOM,get_ctx)(domain), isl_error_invalid,
44
168
      "incompatible spaces", return isl_stat_error);
45
168
46
168
  return isl_stat_ok;
47
168
}
isl_aff.c:isl_multi_union_pw_aff_check_compatible_domain
Line
Count
Source
36
150
{
37
150
  isl_bool ok;
38
150
39
150
  ok = FN(MULTI(BASE),compatible_domain)(multi, domain);
40
150
  if (ok < 0)
41
0
    return isl_stat_error;
42
150
  if (!ok)
43
150
    
isl_die0
(FN(DOM,get_ctx)(domain), isl_error_invalid,
44
150
      "incompatible spaces", return isl_stat_error);
45
150
46
150
  return isl_stat_ok;
47
150
}
48
49
/* Intersect the explicit domain of "multi" with "domain".
50
 *
51
 * The parameters of "multi" and "domain" are assumed to have been aligned.
52
 *
53
 * In the case of an isl_multi_union_pw_aff object, the explicit domain
54
 * is allowed to have only constraints on the parameters, while
55
 * "domain" contains actual domain elements.  In this case,
56
 * "domain" is intersected with those parameter constraints and
57
 * then used as the explicit domain of "multi".
58
 */
59
static __isl_give MULTI(BASE) *FN(MULTI(BASE),domain_intersect_aligned)(
60
  __isl_take MULTI(BASE) *multi, __isl_take DOM *domain)
61
318
{
62
318
  isl_bool is_params;
63
318
  DOM *multi_dom;
64
318
65
318
  if (FN(MULTI(BASE),check_compatible_domain)(multi, domain) < 0)
66
0
    goto error;
67
318
  if (FN(MULTI(BASE),check_has_explicit_domain)(multi) < 0)
68
0
    goto error;
69
318
  is_params = FN(DOM,is_params)(multi->u.dom);
70
318
  if (is_params < 0)
71
0
    goto error;
72
318
  multi_dom = FN(MULTI(BASE),get_explicit_domain)(multi);
73
318
  if (!is_params) {
74
163
    domain = FN(DOM,intersect)(multi_dom, domain);
75
163
  } else {
76
155
    isl_set *params;
77
155
78
155
    params = FN(DOM,params)(multi_dom);
79
155
    domain = FN(DOM,intersect_params)(domain, params);
80
155
  }
81
318
  multi = FN(MULTI(BASE),set_explicit_domain)(multi, domain);
82
318
  return multi;
83
318
error:
84
0
  FN(MULTI(BASE),free)(multi);
85
0
  FN(DOM,free)(domain);
86
0
  return NULL;
87
318
}
isl_aff.c:isl_multi_pw_aff_domain_intersect_aligned
Line
Count
Source
61
168
{
62
168
  isl_bool is_params;
63
168
  DOM *multi_dom;
64
168
65
168
  if (FN(MULTI(BASE),check_compatible_domain)(multi, domain) < 0)
66
0
    goto error;
67
168
  if (FN(MULTI(BASE),check_has_explicit_domain)(multi) < 0)
68
0
    goto error;
69
168
  is_params = FN(DOM,is_params)(multi->u.dom);
70
168
  if (is_params < 0)
71
0
    goto error;
72
168
  multi_dom = FN(MULTI(BASE),get_explicit_domain)(multi);
73
168
  if (!is_params) {
74
157
    domain = FN(DOM,intersect)(multi_dom, domain);
75
157
  } else {
76
11
    isl_set *params;
77
11
78
11
    params = FN(DOM,params)(multi_dom);
79
11
    domain = FN(DOM,intersect_params)(domain, params);
80
11
  }
81
168
  multi = FN(MULTI(BASE),set_explicit_domain)(multi, domain);
82
168
  return multi;
83
168
error:
84
0
  FN(MULTI(BASE),free)(multi);
85
0
  FN(DOM,free)(domain);
86
0
  return NULL;
87
168
}
isl_aff.c:isl_multi_union_pw_aff_domain_intersect_aligned
Line
Count
Source
61
150
{
62
150
  isl_bool is_params;
63
150
  DOM *multi_dom;
64
150
65
150
  if (FN(MULTI(BASE),check_compatible_domain)(multi, domain) < 0)
66
0
    goto error;
67
150
  if (FN(MULTI(BASE),check_has_explicit_domain)(multi) < 0)
68
0
    goto error;
69
150
  is_params = FN(DOM,is_params)(multi->u.dom);
70
150
  if (is_params < 0)
71
0
    goto error;
72
150
  multi_dom = FN(MULTI(BASE),get_explicit_domain)(multi);
73
150
  if (!is_params) {
74
6
    domain = FN(DOM,intersect)(multi_dom, domain);
75
144
  } else {
76
144
    isl_set *params;
77
144
78
144
    params = FN(DOM,params)(multi_dom);
79
144
    domain = FN(DOM,intersect_params)(domain, params);
80
144
  }
81
150
  multi = FN(MULTI(BASE),set_explicit_domain)(multi, domain);
82
150
  return multi;
83
150
error:
84
0
  FN(MULTI(BASE),free)(multi);
85
0
  FN(DOM,free)(domain);
86
0
  return NULL;
87
150
}
88
89
/* Intersect the explicit domain of "multi" with "domain".
90
 * First align the parameters, if needed.
91
 */
92
static __isl_give MULTI(BASE) *FN(MULTI(BASE),domain_intersect)(
93
  __isl_take MULTI(BASE) *multi, __isl_take DOM *domain)
94
318
{
95
318
  return FN(FN(MULTI(BASE),align_params),DOMBASE)(multi, domain,
96
318
            FN(MULTI(BASE),domain_intersect_aligned));
97
318
}
isl_aff.c:isl_multi_pw_aff_domain_intersect
Line
Count
Source
94
168
{
95
168
  return FN(FN(MULTI(BASE),align_params),DOMBASE)(multi, domain,
96
168
            FN(MULTI(BASE),domain_intersect_aligned));
97
168
}
isl_aff.c:isl_multi_union_pw_aff_domain_intersect
Line
Count
Source
94
150
{
95
150
  return FN(FN(MULTI(BASE),align_params),DOMBASE)(multi, domain,
96
150
            FN(MULTI(BASE),domain_intersect_aligned));
97
150
}
98
99
/* Intersect the domain of "multi" with "domain".
100
 *
101
 * If "multi" has an explicit domain, then only this domain
102
 * needs to be intersected.
103
 */
104
__isl_give MULTI(BASE) *FN(MULTI(BASE),intersect_domain)(
105
  __isl_take MULTI(BASE) *multi, __isl_take DOM *domain)
106
435
{
107
435
  if (FN(MULTI(BASE),has_explicit_domain)(multi))
108
318
    return FN(MULTI(BASE),domain_intersect)(multi, domain);
109
117
  return FN(FN(MULTI(BASE),apply),DOMBASE)(multi, domain,
110
117
          &FN(EL,intersect_domain));
111
117
}
isl_multi_pw_aff_intersect_domain
Line
Count
Source
106
256
{
107
256
  if (FN(MULTI(BASE),has_explicit_domain)(multi))
108
168
    return FN(MULTI(BASE),domain_intersect)(multi, domain);
109
88
  return FN(FN(MULTI(BASE),apply),DOMBASE)(multi, domain,
110
88
          &FN(EL,intersect_domain));
111
88
}
isl_multi_union_pw_aff_intersect_domain
Line
Count
Source
106
179
{
107
179
  if (FN(MULTI(BASE),has_explicit_domain)(multi))
108
150
    return FN(MULTI(BASE),domain_intersect)(multi, domain);
109
29
  return FN(FN(MULTI(BASE),apply),DOMBASE)(multi, domain,
110
29
          &FN(EL,intersect_domain));
111
29
}
112
113
/* Intersect the parameter domain of the explicit domain of "multi"
114
 * with "domain".
115
 */
116
static __isl_give MULTI(BASE) *FN(MULTI(BASE),domain_intersect_params_aligned)(
117
  __isl_take MULTI(BASE) *multi, __isl_take isl_set *domain)
118
13
{
119
13
  DOM *multi_dom;
120
13
121
13
  multi_dom = FN(MULTI(BASE),get_explicit_domain)(multi);
122
13
  multi_dom = FN(DOM,intersect_params)(multi_dom, domain);
123
13
  multi = FN(MULTI(BASE),set_explicit_domain)(multi, multi_dom);
124
13
125
13
  return multi;
126
13
}
Unexecuted instantiation: isl_aff.c:isl_multi_pw_aff_domain_intersect_params_aligned
isl_aff.c:isl_multi_union_pw_aff_domain_intersect_params_aligned
Line
Count
Source
118
13
{
119
13
  DOM *multi_dom;
120
13
121
13
  multi_dom = FN(MULTI(BASE),get_explicit_domain)(multi);
122
13
  multi_dom = FN(DOM,intersect_params)(multi_dom, domain);
123
13
  multi = FN(MULTI(BASE),set_explicit_domain)(multi, multi_dom);
124
13
125
13
  return multi;
126
13
}
127
128
/* Intersect the parameter domain of the explicit domain of "multi"
129
 * with "domain".
130
 * First align the parameters, if needed.
131
 */
132
static __isl_give MULTI(BASE) *FN(MULTI(BASE),domain_intersect_params)(
133
  __isl_take MULTI(BASE) *multi, __isl_take isl_set *domain)
134
13
{
135
13
  return FN(FN(MULTI(BASE),align_params),set)(multi, domain,
136
13
          FN(MULTI(BASE),domain_intersect_params_aligned));
137
13
}
Unexecuted instantiation: isl_aff.c:isl_multi_pw_aff_domain_intersect_params
isl_aff.c:isl_multi_union_pw_aff_domain_intersect_params
Line
Count
Source
134
13
{
135
13
  return FN(FN(MULTI(BASE),align_params),set)(multi, domain,
136
13
          FN(MULTI(BASE),domain_intersect_params_aligned));
137
13
}
138
139
/* Intersect the parameter domain of "multi" with "domain".
140
 *
141
 * If "multi" has an explicit domain, then only this domain
142
 * needs to be intersected.
143
 */
144
__isl_give MULTI(BASE) *FN(MULTI(BASE),intersect_params)(
145
  __isl_take MULTI(BASE) *multi, __isl_take isl_set *domain)
146
1.32k
{
147
1.32k
  if (FN(MULTI(BASE),has_explicit_domain)(multi))
148
13
    return FN(MULTI(BASE),domain_intersect_params)(multi, domain);
149
1.31k
  return FN(MULTI(BASE),apply_set)(multi, domain,
150
1.31k
          &FN(EL,intersect_params));
151
1.31k
}
Unexecuted instantiation: isl_multi_pw_aff_intersect_params
isl_multi_union_pw_aff_intersect_params
Line
Count
Source
146
1.32k
{
147
1.32k
  if (FN(MULTI(BASE),has_explicit_domain)(multi))
148
13
    return FN(MULTI(BASE),domain_intersect_params)(multi, domain);
149
1.31k
  return FN(MULTI(BASE),apply_set)(multi, domain,
150
1.31k
          &FN(EL,intersect_params));
151
1.31k
}