Coverage Report

Created: 2018-04-23 18:20

/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
314
{
19
314
  isl_bool ok;
20
314
  isl_space *space, *domain_space;
21
314
22
314
  domain_space = FN(DOM,get_space)(domain);
23
314
  space = FN(MULTI(BASE),get_space)(multi);
24
314
  ok = isl_space_has_domain_tuples(domain_space, space);
25
314
  isl_space_free(space);
26
314
  isl_space_free(domain_space);
27
314
28
314
  return ok;
29
314
}
isl_aff.c:isl_multi_pw_aff_compatible_domain
Line
Count
Source
18
171
{
19
171
  isl_bool ok;
20
171
  isl_space *space, *domain_space;
21
171
22
171
  domain_space = FN(DOM,get_space)(domain);
23
171
  space = FN(MULTI(BASE),get_space)(multi);
24
171
  ok = isl_space_has_domain_tuples(domain_space, space);
25
171
  isl_space_free(space);
26
171
  isl_space_free(domain_space);
27
171
28
171
  return ok;
29
171
}
isl_aff.c:isl_multi_union_pw_aff_compatible_domain
Line
Count
Source
18
143
{
19
143
  isl_bool ok;
20
143
  isl_space *space, *domain_space;
21
143
22
143
  domain_space = FN(DOM,get_space)(domain);
23
143
  space = FN(MULTI(BASE),get_space)(multi);
24
143
  ok = isl_space_has_domain_tuples(domain_space, space);
25
143
  isl_space_free(space);
26
143
  isl_space_free(domain_space);
27
143
28
143
  return ok;
29
143
}
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
314
{
37
314
  isl_bool ok;
38
314
39
314
  ok = FN(MULTI(BASE),compatible_domain)(multi, domain);
40
314
  if (ok < 0)
41
0
    return isl_stat_error;
42
314
  if (!ok)
43
314
    
isl_die0
(FN(DOM,get_ctx)(domain), isl_error_invalid,
44
314
      "incompatible spaces", return isl_stat_error);
45
314
46
314
  return isl_stat_ok;
47
314
}
isl_aff.c:isl_multi_pw_aff_check_compatible_domain
Line
Count
Source
36
171
{
37
171
  isl_bool ok;
38
171
39
171
  ok = FN(MULTI(BASE),compatible_domain)(multi, domain);
40
171
  if (ok < 0)
41
0
    return isl_stat_error;
42
171
  if (!ok)
43
171
    
isl_die0
(FN(DOM,get_ctx)(domain), isl_error_invalid,
44
171
      "incompatible spaces", return isl_stat_error);
45
171
46
171
  return isl_stat_ok;
47
171
}
isl_aff.c:isl_multi_union_pw_aff_check_compatible_domain
Line
Count
Source
36
143
{
37
143
  isl_bool ok;
38
143
39
143
  ok = FN(MULTI(BASE),compatible_domain)(multi, domain);
40
143
  if (ok < 0)
41
0
    return isl_stat_error;
42
143
  if (!ok)
43
143
    
isl_die0
(FN(DOM,get_ctx)(domain), isl_error_invalid,
44
143
      "incompatible spaces", return isl_stat_error);
45
143
46
143
  return isl_stat_ok;
47
143
}
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
314
{
62
314
  isl_bool is_params;
63
314
  DOM *multi_dom;
64
314
65
314
  if (FN(MULTI(BASE),check_compatible_domain)(multi, domain) < 0)
66
0
    goto error;
67
314
  if (FN(MULTI(BASE),check_has_explicit_domain)(multi) < 0)
68
0
    goto error;
69
314
  is_params = FN(DOM,is_params)(multi->u.dom);
70
314
  if (is_params < 0)
71
0
    goto error;
72
314
  multi_dom = FN(MULTI(BASE),get_explicit_domain)(multi);
73
314
  if (!is_params) {
74
166
    domain = FN(DOM,intersect)(multi_dom, domain);
75
166
  } else {
76
148
    isl_set *params;
77
148
78
148
    params = FN(DOM,params)(multi_dom);
79
148
    domain = FN(DOM,intersect_params)(domain, params);
80
148
  }
81
314
  multi = FN(MULTI(BASE),set_explicit_domain)(multi, domain);
82
314
  return multi;
83
314
error:
84
0
  FN(MULTI(BASE),free)(multi);
85
0
  FN(DOM,free)(domain);
86
0
  return NULL;
87
314
}
isl_aff.c:isl_multi_pw_aff_domain_intersect_aligned
Line
Count
Source
61
171
{
62
171
  isl_bool is_params;
63
171
  DOM *multi_dom;
64
171
65
171
  if (FN(MULTI(BASE),check_compatible_domain)(multi, domain) < 0)
66
0
    goto error;
67
171
  if (FN(MULTI(BASE),check_has_explicit_domain)(multi) < 0)
68
0
    goto error;
69
171
  is_params = FN(DOM,is_params)(multi->u.dom);
70
171
  if (is_params < 0)
71
0
    goto error;
72
171
  multi_dom = FN(MULTI(BASE),get_explicit_domain)(multi);
73
171
  if (!is_params) {
74
160
    domain = FN(DOM,intersect)(multi_dom, domain);
75
160
  } 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
171
  multi = FN(MULTI(BASE),set_explicit_domain)(multi, domain);
82
171
  return multi;
83
171
error:
84
0
  FN(MULTI(BASE),free)(multi);
85
0
  FN(DOM,free)(domain);
86
0
  return NULL;
87
171
}
isl_aff.c:isl_multi_union_pw_aff_domain_intersect_aligned
Line
Count
Source
61
143
{
62
143
  isl_bool is_params;
63
143
  DOM *multi_dom;
64
143
65
143
  if (FN(MULTI(BASE),check_compatible_domain)(multi, domain) < 0)
66
0
    goto error;
67
143
  if (FN(MULTI(BASE),check_has_explicit_domain)(multi) < 0)
68
0
    goto error;
69
143
  is_params = FN(DOM,is_params)(multi->u.dom);
70
143
  if (is_params < 0)
71
0
    goto error;
72
143
  multi_dom = FN(MULTI(BASE),get_explicit_domain)(multi);
73
143
  if (!is_params) {
74
6
    domain = FN(DOM,intersect)(multi_dom, domain);
75
137
  } else {
76
137
    isl_set *params;
77
137
78
137
    params = FN(DOM,params)(multi_dom);
79
137
    domain = FN(DOM,intersect_params)(domain, params);
80
137
  }
81
143
  multi = FN(MULTI(BASE),set_explicit_domain)(multi, domain);
82
143
  return multi;
83
143
error:
84
0
  FN(MULTI(BASE),free)(multi);
85
0
  FN(DOM,free)(domain);
86
0
  return NULL;
87
143
}
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
314
{
95
314
  return FN(FN(MULTI(BASE),align_params),DOMBASE)(multi, domain,
96
314
            FN(MULTI(BASE),domain_intersect_aligned));
97
314
}
isl_aff.c:isl_multi_pw_aff_domain_intersect
Line
Count
Source
94
171
{
95
171
  return FN(FN(MULTI(BASE),align_params),DOMBASE)(multi, domain,
96
171
            FN(MULTI(BASE),domain_intersect_aligned));
97
171
}
isl_aff.c:isl_multi_union_pw_aff_domain_intersect
Line
Count
Source
94
143
{
95
143
  return FN(FN(MULTI(BASE),align_params),DOMBASE)(multi, domain,
96
143
            FN(MULTI(BASE),domain_intersect_aligned));
97
143
}
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
1.73k
{
107
1.73k
  if (FN(MULTI(BASE),has_explicit_domain)(multi))
108
314
    return FN(MULTI(BASE),domain_intersect)(multi, domain);
109
1.42k
  return FN(FN(MULTI(BASE),apply),DOMBASE)(multi, domain,
110
1.42k
          &FN(EL,intersect_domain));
111
1.42k
}
isl_multi_pw_aff_intersect_domain
Line
Count
Source
106
257
{
107
257
  if (FN(MULTI(BASE),has_explicit_domain)(multi))
108
171
    return FN(MULTI(BASE),domain_intersect)(multi, domain);
109
86
  return FN(FN(MULTI(BASE),apply),DOMBASE)(multi, domain,
110
86
          &FN(EL,intersect_domain));
111
86
}
isl_multi_union_pw_aff_intersect_domain
Line
Count
Source
106
1.48k
{
107
1.48k
  if (FN(MULTI(BASE),has_explicit_domain)(multi))
108
143
    return FN(MULTI(BASE),domain_intersect)(multi, domain);
109
1.33k
  return FN(FN(MULTI(BASE),apply),DOMBASE)(multi, domain,
110
1.33k
          &FN(EL,intersect_domain));
111
1.33k
}
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
11
{
119
11
  DOM *multi_dom;
120
11
121
11
  multi_dom = FN(MULTI(BASE),get_explicit_domain)(multi);
122
11
  multi_dom = FN(DOM,intersect_params)(multi_dom, domain);
123
11
  multi = FN(MULTI(BASE),set_explicit_domain)(multi, multi_dom);
124
11
125
11
  return multi;
126
11
}
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
11
{
119
11
  DOM *multi_dom;
120
11
121
11
  multi_dom = FN(MULTI(BASE),get_explicit_domain)(multi);
122
11
  multi_dom = FN(DOM,intersect_params)(multi_dom, domain);
123
11
  multi = FN(MULTI(BASE),set_explicit_domain)(multi, multi_dom);
124
11
125
11
  return multi;
126
11
}
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
11
{
135
11
  return FN(FN(MULTI(BASE),align_params),set)(multi, domain,
136
11
          FN(MULTI(BASE),domain_intersect_params_aligned));
137
11
}
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
11
{
135
11
  return FN(FN(MULTI(BASE),align_params),set)(multi, domain,
136
11
          FN(MULTI(BASE),domain_intersect_params_aligned));
137
11
}
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
14
{
147
14
  if (FN(MULTI(BASE),has_explicit_domain)(multi))
148
11
    return FN(MULTI(BASE),domain_intersect_params)(multi, domain);
149
3
  return FN(MULTI(BASE),apply_set)(multi, domain,
150
3
          &FN(EL,intersect_params));
151
3
}
Unexecuted instantiation: isl_multi_pw_aff_intersect_params
isl_multi_union_pw_aff_intersect_params
Line
Count
Source
146
14
{
147
14
  if (FN(MULTI(BASE),has_explicit_domain)(multi))
148
11
    return FN(MULTI(BASE),domain_intersect_params)(multi, domain);
149
3
  return FN(MULTI(BASE),apply_set)(multi, domain,
150
3
          &FN(EL,intersect_params));
151
3
}