Coverage Report

Created: 2019-07-24 05:18

/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
317
{
19
317
  isl_bool ok;
20
317
  isl_space *space, *domain_space;
21
317
22
317
  domain_space = FN(DOM,get_space)(domain);
23
317
  space = FN(MULTI(BASE),get_space)(multi);
24
317
  ok = isl_space_has_domain_tuples(domain_space, space);
25
317
  isl_space_free(space);
26
317
  isl_space_free(domain_space);
27
317
28
317
  return ok;
29
317
}
isl_aff.c:isl_multi_pw_aff_compatible_domain
Line
Count
Source
18
167
{
19
167
  isl_bool ok;
20
167
  isl_space *space, *domain_space;
21
167
22
167
  domain_space = FN(DOM,get_space)(domain);
23
167
  space = FN(MULTI(BASE),get_space)(multi);
24
167
  ok = isl_space_has_domain_tuples(domain_space, space);
25
167
  isl_space_free(space);
26
167
  isl_space_free(domain_space);
27
167
28
167
  return ok;
29
167
}
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
317
{
37
317
  isl_bool ok;
38
317
39
317
  ok = FN(MULTI(BASE),compatible_domain)(multi, domain);
40
317
  if (ok < 0)
41
0
    return isl_stat_error;
42
317
  if (!ok)
43
317
    
isl_die0
(FN(DOM,get_ctx)(domain), isl_error_invalid,
44
317
      "incompatible spaces", return isl_stat_error);
45
317
46
317
  return isl_stat_ok;
47
317
}
isl_aff.c:isl_multi_pw_aff_check_compatible_domain
Line
Count
Source
36
167
{
37
167
  isl_bool ok;
38
167
39
167
  ok = FN(MULTI(BASE),compatible_domain)(multi, domain);
40
167
  if (ok < 0)
41
0
    return isl_stat_error;
42
167
  if (!ok)
43
167
    
isl_die0
(FN(DOM,get_ctx)(domain), isl_error_invalid,
44
167
      "incompatible spaces", return isl_stat_error);
45
167
46
167
  return isl_stat_ok;
47
167
}
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
317
{
62
317
  isl_bool is_params;
63
317
  DOM *multi_dom;
64
317
65
317
  if (FN(MULTI(BASE),check_compatible_domain)(multi, domain) < 0)
66
0
    goto error;
67
317
  if (FN(MULTI(BASE),check_has_explicit_domain)(multi) < 0)
68
0
    goto error;
69
317
  is_params = FN(DOM,is_params)(multi->u.dom);
70
317
  if (is_params < 0)
71
0
    goto error;
72
317
  multi_dom = FN(MULTI(BASE),get_explicit_domain)(multi);
73
317
  if (!is_params) {
74
162
    domain = FN(DOM,intersect)(multi_dom, domain);
75
162
  } 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
317
  multi = FN(MULTI(BASE),set_explicit_domain)(multi, domain);
82
317
  return multi;
83
317
error:
84
0
  FN(MULTI(BASE),free)(multi);
85
0
  FN(DOM,free)(domain);
86
0
  return NULL;
87
317
}
isl_aff.c:isl_multi_pw_aff_domain_intersect_aligned
Line
Count
Source
61
167
{
62
167
  isl_bool is_params;
63
167
  DOM *multi_dom;
64
167
65
167
  if (FN(MULTI(BASE),check_compatible_domain)(multi, domain) < 0)
66
0
    goto error;
67
167
  if (FN(MULTI(BASE),check_has_explicit_domain)(multi) < 0)
68
0
    goto error;
69
167
  is_params = FN(DOM,is_params)(multi->u.dom);
70
167
  if (is_params < 0)
71
0
    goto error;
72
167
  multi_dom = FN(MULTI(BASE),get_explicit_domain)(multi);
73
167
  if (!is_params) {
74
156
    domain = FN(DOM,intersect)(multi_dom, domain);
75
156
  } 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
167
  multi = FN(MULTI(BASE),set_explicit_domain)(multi, domain);
82
167
  return multi;
83
167
error:
84
0
  FN(MULTI(BASE),free)(multi);
85
0
  FN(DOM,free)(domain);
86
0
  return NULL;
87
167
}
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
317
{
95
317
  return FN(FN(MULTI(BASE),align_params),DOMBASE)(multi, domain,
96
317
            FN(MULTI(BASE),domain_intersect_aligned));
97
317
}
isl_aff.c:isl_multi_pw_aff_domain_intersect
Line
Count
Source
94
167
{
95
167
  return FN(FN(MULTI(BASE),align_params),DOMBASE)(multi, domain,
96
167
            FN(MULTI(BASE),domain_intersect_aligned));
97
167
}
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
434
{
107
434
  if (FN(MULTI(BASE),has_explicit_domain)(multi))
108
317
    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
255
{
107
255
  if (FN(MULTI(BASE),has_explicit_domain)(multi))
108
167
    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.33k
{
147
1.33k
  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.33k
{
147
1.33k
  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
}