Coverage Report

Created: 2019-07-24 05:18

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/tools/polly/lib/External/isl/isl_pw_eval.c
Line
Count
Source (jump to first uncovered line)
1
/*
2
 * Copyright 2010      INRIA Saclay
3
 * Copyright 2013      Ecole Normale Superieure
4
 *
5
 * Use of this software is governed by the MIT license
6
 *
7
 * Written by Sven Verdoolaege, INRIA Saclay - Ile-de-France,
8
 * Parc Club Orsay Universite, ZAC des vignes, 4 rue Jacques Monod,
9
 * 91893 Orsay, France
10
 * and Ecole Normale Superieure, 45 rue d'Ulm, 75230 Paris, France
11
 */
12
13
#include <isl/val.h>
14
#include <isl_space_private.h>
15
#include <isl_point_private.h>
16
17
#include <isl_pw_macro.h>
18
19
/* Evaluate "pw" in the void point "pnt".
20
 * In particular, return the value NaN.
21
 */
22
static __isl_give isl_val *FN(PW,eval_void)(__isl_take PW *pw,
23
  __isl_take isl_point *pnt)
24
2
{
25
2
  isl_ctx *ctx;
26
2
27
2
  ctx = isl_point_get_ctx(pnt);
28
2
  FN(PW,free)(pw);
29
2
  isl_point_free(pnt);
30
2
  return isl_val_nan(ctx);
31
2
}
isl_aff.c:isl_pw_aff_eval_void
Line
Count
Source
24
2
{
25
2
  isl_ctx *ctx;
26
2
27
2
  ctx = isl_point_get_ctx(pnt);
28
2
  FN(PW,free)(pw);
29
2
  isl_point_free(pnt);
30
2
  return isl_val_nan(ctx);
31
2
}
Unexecuted instantiation: isl_fold.c:isl_pw_qpolynomial_fold_eval_void
Unexecuted instantiation: isl_polynomial.c:isl_pw_qpolynomial_eval_void
32
33
/* Evaluate the piecewise function "pw" in "pnt".
34
 * If the point is void, then return NaN.
35
 * If the point lies outside the domain of "pw", then return 0 or NaN
36
 * depending on whether 0 is the default value for this type of function.
37
 */
38
__isl_give isl_val *FN(PW,eval)(__isl_take PW *pw, __isl_take isl_point *pnt)
39
24
{
40
24
  int i;
41
24
  isl_bool is_void;
42
24
  isl_bool found;
43
24
  isl_ctx *ctx;
44
24
  isl_bool ok;
45
24
  isl_space *pnt_space, *pw_space;
46
24
  isl_val *v;
47
24
48
24
  pnt_space = isl_point_peek_space(pnt);
49
24
  pw_space = FN(PW,peek_space)(pw);
50
24
  ok = isl_space_is_domain_internal(pnt_space, pw_space);
51
24
  if (ok < 0)
52
0
    goto error;
53
24
  ctx = isl_point_get_ctx(pnt);
54
24
  if (!ok)
55
24
    
isl_die0
(ctx, isl_error_invalid,
56
24
      "incompatible spaces", goto error);
57
24
  is_void = isl_point_is_void(pnt);
58
24
  if (is_void < 0)
59
0
    goto error;
60
24
  if (is_void)
61
2
    return FN(PW,eval_void)(pw, pnt);
62
22
63
22
  found = isl_bool_false;
64
26
  for (i = 0; i < pw->n; 
++i4
) {
65
24
    found = isl_set_contains_point(pw->p[i].set, pnt);
66
24
    if (found < 0)
67
0
      goto error;
68
24
    if (found)
69
20
      break;
70
24
  }
71
22
  if (found) {
72
20
    v = FN(EL,eval)(FN(EL,copy)(pw->p[i].FIELD),
73
20
              isl_point_copy(pnt));
74
20
  } else 
if (2
DEFAULT_IS_ZERO2
) {
75
0
    v = isl_val_zero(ctx);
76
2
  } else {
77
2
    v = isl_val_nan(ctx);
78
2
  }
79
22
  FN(PW,free)(pw);
80
22
  isl_point_free(pnt);
81
22
  return v;
82
22
error:
83
0
  FN(PW,free)(pw);
84
0
  isl_point_free(pnt);
85
0
  return NULL;
86
22
}
isl_pw_aff_eval
Line
Count
Source
39
23
{
40
23
  int i;
41
23
  isl_bool is_void;
42
23
  isl_bool found;
43
23
  isl_ctx *ctx;
44
23
  isl_bool ok;
45
23
  isl_space *pnt_space, *pw_space;
46
23
  isl_val *v;
47
23
48
23
  pnt_space = isl_point_peek_space(pnt);
49
23
  pw_space = FN(PW,peek_space)(pw);
50
23
  ok = isl_space_is_domain_internal(pnt_space, pw_space);
51
23
  if (ok < 0)
52
0
    goto error;
53
23
  ctx = isl_point_get_ctx(pnt);
54
23
  if (!ok)
55
23
    
isl_die0
(ctx, isl_error_invalid,
56
23
      "incompatible spaces", goto error);
57
23
  is_void = isl_point_is_void(pnt);
58
23
  if (is_void < 0)
59
0
    goto error;
60
23
  if (is_void)
61
2
    return FN(PW,eval_void)(pw, pnt);
62
21
63
21
  found = isl_bool_false;
64
25
  for (i = 0; i < pw->n; 
++i4
) {
65
23
    found = isl_set_contains_point(pw->p[i].set, pnt);
66
23
    if (found < 0)
67
0
      goto error;
68
23
    if (found)
69
19
      break;
70
23
  }
71
21
  if (found) {
72
19
    v = FN(EL,eval)(FN(EL,copy)(pw->p[i].FIELD),
73
19
              isl_point_copy(pnt));
74
19
  } else 
if (2
DEFAULT_IS_ZERO2
) {
75
0
    v = isl_val_zero(ctx);
76
2
  } else {
77
2
    v = isl_val_nan(ctx);
78
2
  }
79
21
  FN(PW,free)(pw);
80
21
  isl_point_free(pnt);
81
21
  return v;
82
21
error:
83
0
  FN(PW,free)(pw);
84
0
  isl_point_free(pnt);
85
0
  return NULL;
86
21
}
Unexecuted instantiation: isl_pw_qpolynomial_fold_eval
isl_pw_qpolynomial_eval
Line
Count
Source
39
1
{
40
1
  int i;
41
1
  isl_bool is_void;
42
1
  isl_bool found;
43
1
  isl_ctx *ctx;
44
1
  isl_bool ok;
45
1
  isl_space *pnt_space, *pw_space;
46
1
  isl_val *v;
47
1
48
1
  pnt_space = isl_point_peek_space(pnt);
49
1
  pw_space = FN(PW,peek_space)(pw);
50
1
  ok = isl_space_is_domain_internal(pnt_space, pw_space);
51
1
  if (ok < 0)
52
0
    goto error;
53
1
  ctx = isl_point_get_ctx(pnt);
54
1
  if (!ok)
55
1
    
isl_die0
(ctx, isl_error_invalid,
56
1
      "incompatible spaces", goto error);
57
1
  is_void = isl_point_is_void(pnt);
58
1
  if (is_void < 0)
59
0
    goto error;
60
1
  if (is_void)
61
0
    return FN(PW,eval_void)(pw, pnt);
62
1
63
1
  found = isl_bool_false;
64
1
  for (i = 0; i < pw->n; 
++i0
) {
65
1
    found = isl_set_contains_point(pw->p[i].set, pnt);
66
1
    if (found < 0)
67
0
      goto error;
68
1
    if (found)
69
1
      break;
70
1
  }
71
1
  if (found) {
72
1
    v = FN(EL,eval)(FN(EL,copy)(pw->p[i].FIELD),
73
1
              isl_point_copy(pnt));
74
1
  } else 
if (0
DEFAULT_IS_ZERO0
) {
75
0
    v = isl_val_zero(ctx);
76
0
  } else {
77
0
    v = isl_val_nan(ctx);
78
0
  }
79
1
  FN(PW,free)(pw);
80
1
  isl_point_free(pnt);
81
1
  return v;
82
1
error:
83
0
  FN(PW,free)(pw);
84
0
  isl_point_free(pnt);
85
0
  return NULL;
86
1
}