Coverage Report

Created: 2017-03-27 23:01

/Users/buildslave/jenkins/sharedspace/clang-stage2-coverage-R@2/llvm/tools/polly/lib/External/isl/isl_vec.c
Line
Count
Source (jump to first uncovered line)
1
/*
2
 * Copyright 2008-2009 Katholieke Universiteit Leuven
3
 * Copyright 2013      Ecole Normale Superieure
4
 *
5
 * Use of this software is governed by the MIT license
6
 *
7
 * Written by Sven Verdoolaege, K.U.Leuven, Departement
8
 * Computerwetenschappen, Celestijnenlaan 200A, B-3001 Leuven, Belgium
9
 * and Ecole Normale Superieure, 45 rue d’Ulm, 75230 Paris, France
10
 */
11
12
#include <isl_ctx_private.h>
13
#include <isl_seq.h>
14
#include <isl_val_private.h>
15
#include <isl_vec_private.h>
16
#include <isl/deprecated/vec_int.h>
17
18
isl_ctx *isl_vec_get_ctx(__isl_keep isl_vec *vec)
19
50.0k
{
20
50.0k
  return vec ? vec->ctx : NULL;
21
50.0k
}
22
23
/* Return a hash value that digests "vec".
24
 */
25
uint32_t isl_vec_get_hash(__isl_keep isl_vec *vec)
26
0
{
27
0
  if (!vec)
28
0
    return 0;
29
0
30
0
  return isl_seq_get_hash(vec->el, vec->size);
31
0
}
32
33
struct isl_vec *isl_vec_alloc(struct isl_ctx *ctx, unsigned size)
34
1.22M
{
35
1.22M
  struct isl_vec *vec;
36
1.22M
37
1.22M
  vec = isl_alloc_type(ctx, struct isl_vec);
38
1.22M
  if (!vec)
39
0
    return NULL;
40
1.22M
41
1.22M
  vec->block = isl_blk_alloc(ctx, size);
42
1.22M
  if (isl_blk_is_error(vec->block))
43
0
    goto error;
44
1.22M
45
1.22M
  vec->ctx = ctx;
46
1.22M
  isl_ctx_ref(ctx);
47
1.22M
  vec->ref = 1;
48
1.22M
  vec->size = size;
49
1.22M
  vec->el = vec->block.data;
50
1.22M
51
1.22M
  return vec;
52
0
error:
53
0
  isl_blk_free(ctx, vec->block);
54
0
  free(vec);
55
0
  return NULL;
56
1.22M
}
57
58
__isl_give isl_vec *isl_vec_extend(__isl_take isl_vec *vec, unsigned size)
59
22.4k
{
60
22.4k
  if (!vec)
61
0
    return NULL;
62
22.4k
  
if (22.4k
size <= vec->size22.4k
)
63
0
    return vec;
64
22.4k
65
22.4k
  vec = isl_vec_cow(vec);
66
22.4k
  if (!vec)
67
0
    return NULL;
68
22.4k
69
22.4k
  vec->block = isl_blk_extend(vec->ctx, vec->block, size);
70
22.4k
  if (!vec->block.data)
71
0
    goto error;
72
22.4k
73
22.4k
  vec->size = size;
74
22.4k
  vec->el = vec->block.data;
75
22.4k
76
22.4k
  return vec;
77
0
error:
78
0
  isl_vec_free(vec);
79
0
  return NULL;
80
22.4k
}
81
82
/* Apply the expansion specified by "exp" to the "n" elements starting at "pos".
83
 * "expanded" it the number of elements that need to replace those "n"
84
 * elements.  The entries in "exp" have increasing values between
85
 * 0 and "expanded".
86
 */
87
__isl_give isl_vec *isl_vec_expand(__isl_take isl_vec *vec, int pos, int n,
88
  int *exp, int expanded)
89
36.8k
{
90
36.8k
  int i, j;
91
36.8k
  int old_size, extra;
92
36.8k
93
36.8k
  if (!vec)
94
0
    return NULL;
95
36.8k
  
if (36.8k
expanded < n36.8k
)
96
0
    isl_die(isl_vec_get_ctx(vec), isl_error_invalid,
97
36.8k
      "not an expansion", return isl_vec_free(vec));
98
36.8k
  
if (36.8k
expanded == n36.8k
)
99
18.2k
    return vec;
100
18.6k
  
if (18.6k
pos < 0 || 18.6k
n < 018.6k
||
pos + n > vec->size18.6k
)
101
0
    isl_die(isl_vec_get_ctx(vec), isl_error_invalid,
102
18.6k
      "position out of bounds", return isl_vec_free(vec));
103
18.6k
104
18.6k
  old_size = vec->size;
105
18.6k
  extra = expanded - n;
106
18.6k
  vec = isl_vec_extend(vec, old_size + extra);
107
18.6k
  vec = isl_vec_cow(vec);
108
18.6k
  if (!vec)
109
0
    return NULL;
110
18.6k
111
18.6k
  
for (i = old_size - 1; 18.6k
i >= pos + n18.6k
;
--i0
)
112
0
    isl_int_set(vec->el[i + extra], vec->el[i]);
113
18.6k
114
18.6k
  j = n - 1;
115
37.8k
  for (i = expanded - 1; 
i >= 037.8k
;
--i19.1k
)
{19.1k
116
19.1k
    if (
j >= 0 && 19.1k
exp[j] == i492
)
{325
117
325
      if (i != j)
118
109
        isl_int_swap(vec->el[pos + i],
119
325
               vec->el[pos + j]);
120
325
      j--;
121
18.8k
    } else {
122
18.8k
      isl_int_set_si(vec->el[pos + i], 0);
123
18.8k
    }
124
19.1k
  }
125
18.6k
126
18.6k
  return vec;
127
18.6k
}
128
129
__isl_give isl_vec *isl_vec_zero_extend(__isl_take isl_vec *vec, unsigned size)
130
0
{
131
0
  int extra;
132
0
133
0
  if (!vec)
134
0
    return NULL;
135
0
  
if (0
size <= vec->size0
)
136
0
    return vec;
137
0
138
0
  vec = isl_vec_cow(vec);
139
0
  if (!vec)
140
0
    return NULL;
141
0
142
0
  extra = size - vec->size;
143
0
  vec = isl_vec_extend(vec, size);
144
0
  if (!vec)
145
0
    return NULL;
146
0
147
0
  isl_seq_clr(vec->el + size - extra, extra);
148
0
149
0
  return vec;
150
0
}
151
152
/* Return a vector containing the elements of "vec1" followed by
153
 * those of "vec2".
154
 */
155
__isl_give isl_vec *isl_vec_concat(__isl_take isl_vec *vec1,
156
  __isl_take isl_vec *vec2)
157
550
{
158
550
  if (
!vec1 || 550
!vec2550
)
159
0
    goto error;
160
550
161
550
  
if (550
vec2->size == 0550
)
{3
162
3
    isl_vec_free(vec2);
163
3
    return vec1;
164
3
  }
165
550
166
547
  
if (547
vec1->size == 0547
)
{383
167
383
    isl_vec_free(vec1);
168
383
    return vec2;
169
383
  }
170
547
171
164
  vec1 = isl_vec_extend(vec1, vec1->size + vec2->size);
172
164
  if (!vec1)
173
0
    goto error;
174
164
175
164
  isl_seq_cpy(vec1->el + vec1->size - vec2->size, vec2->el, vec2->size);
176
164
177
164
  isl_vec_free(vec2);
178
164
  return vec1;
179
0
error:
180
0
  isl_vec_free(vec1);
181
0
  isl_vec_free(vec2);
182
0
  return NULL;
183
164
}
184
185
struct isl_vec *isl_vec_copy(struct isl_vec *vec)
186
2.62M
{
187
2.62M
  if (!vec)
188
1.19M
    return NULL;
189
2.62M
190
1.43M
  vec->ref++;
191
1.43M
  return vec;
192
2.62M
}
193
194
struct isl_vec *isl_vec_dup(struct isl_vec *vec)
195
114k
{
196
114k
  struct isl_vec *vec2;
197
114k
198
114k
  if (!vec)
199
0
    return NULL;
200
114k
  vec2 = isl_vec_alloc(vec->ctx, vec->size);
201
114k
  if (!vec2)
202
0
    return NULL;
203
114k
  isl_seq_cpy(vec2->el, vec->el, vec->size);
204
114k
  return vec2;
205
114k
}
206
207
struct isl_vec *isl_vec_cow(struct isl_vec *vec)
208
210k
{
209
210k
  struct isl_vec *vec2;
210
210k
  if (!vec)
211
0
    return NULL;
212
210k
213
210k
  
if (210k
vec->ref == 1210k
)
214
95.8k
    return vec;
215
210k
216
114k
  vec2 = isl_vec_dup(vec);
217
114k
  isl_vec_free(vec);
218
114k
  return vec2;
219
210k
}
220
221
__isl_null isl_vec *isl_vec_free(__isl_take isl_vec *vec)
222
5.28M
{
223
5.28M
  if (!vec)
224
2.62M
    return NULL;
225
5.28M
226
2.66M
  
if (2.66M
--vec->ref > 02.66M
)
227
1.43M
    return NULL;
228
2.66M
229
1.22M
  isl_ctx_deref(vec->ctx);
230
1.22M
  isl_blk_free(vec->ctx, vec->block);
231
1.22M
  free(vec);
232
1.22M
233
1.22M
  return NULL;
234
2.66M
}
235
236
int isl_vec_size(__isl_keep isl_vec *vec)
237
7.22k
{
238
7.22k
  return vec ? 
vec->size7.22k
:
-10
;
239
7.22k
}
240
241
int isl_vec_get_element(__isl_keep isl_vec *vec, int pos, isl_int *v)
242
0
{
243
0
  if (!vec)
244
0
    return -1;
245
0
246
0
  
if (0
pos < 0 || 0
pos >= vec->size0
)
247
0
    isl_die(vec->ctx, isl_error_invalid, "position out of range",
248
0
      return -1);
249
0
  
isl_int_set0
(*v, vec->el[pos]);0
250
0
  return 0;
251
0
}
252
253
/* Extract the element at position "pos" of "vec".
254
 */
255
__isl_give isl_val *isl_vec_get_element_val(__isl_keep isl_vec *vec, int pos)
256
7.63k
{
257
7.63k
  isl_ctx *ctx;
258
7.63k
259
7.63k
  if (!vec)
260
0
    return NULL;
261
7.63k
  ctx = isl_vec_get_ctx(vec);
262
7.63k
  if (
pos < 0 || 7.63k
pos >= vec->size7.63k
)
263
0
    isl_die(ctx, isl_error_invalid, "position out of range",
264
7.63k
      return NULL);
265
7.63k
  return isl_val_int_from_isl_int(ctx, vec->el[pos]);
266
7.63k
}
267
268
__isl_give isl_vec *isl_vec_set_element(__isl_take isl_vec *vec,
269
  int pos, isl_int v)
270
1.03k
{
271
1.03k
  vec = isl_vec_cow(vec);
272
1.03k
  if (!vec)
273
0
    return NULL;
274
1.03k
  
if (1.03k
pos < 0 || 1.03k
pos >= vec->size1.03k
)
275
0
    isl_die(vec->ctx, isl_error_invalid, "position out of range",
276
1.03k
      goto error);
277
1.03k
  
isl_int_set1.03k
(vec->el[pos], v);1.03k
278
1.03k
  return vec;
279
0
error:
280
0
  isl_vec_free(vec);
281
0
  return NULL;
282
1.03k
}
283
284
__isl_give isl_vec *isl_vec_set_element_si(__isl_take isl_vec *vec,
285
  int pos, int v)
286
3
{
287
3
  vec = isl_vec_cow(vec);
288
3
  if (!vec)
289
0
    return NULL;
290
3
  
if (3
pos < 0 || 3
pos >= vec->size3
)
291
0
    isl_die(vec->ctx, isl_error_invalid, "position out of range",
292
3
      goto error);
293
3
  
isl_int_set_si3
(vec->el[pos], v);3
294
3
  return vec;
295
0
error:
296
0
  isl_vec_free(vec);
297
0
  return NULL;
298
3
}
299
300
/* Replace the element at position "pos" of "vec" by "v".
301
 */
302
__isl_give isl_vec *isl_vec_set_element_val(__isl_take isl_vec *vec,
303
  int pos, __isl_take isl_val *v)
304
1.03k
{
305
1.03k
  if (!v)
306
0
    return isl_vec_free(vec);
307
1.03k
  
if (1.03k
!isl_val_is_int(v)1.03k
)
308
0
    isl_die(isl_val_get_ctx(v), isl_error_invalid,
309
1.03k
      "expecting integer value", goto error);
310
1.03k
  vec = isl_vec_set_element(vec, pos, v->n);
311
1.03k
  isl_val_free(v);
312
1.03k
  return vec;
313
0
error:
314
0
  isl_val_free(v);
315
0
  return isl_vec_free(vec);
316
1.03k
}
317
318
/* Compare the elements of "vec1" and "vec2" at position "pos".
319
 */
320
int isl_vec_cmp_element(__isl_keep isl_vec *vec1, __isl_keep isl_vec *vec2,
321
  int pos)
322
5.83k
{
323
5.83k
  if (
!vec1 || 5.83k
!vec25.83k
)
324
0
    return 0;
325
5.83k
  
if (5.83k
pos < 0 || 5.83k
pos >= vec1->size5.83k
||
pos >= vec2->size5.83k
)
326
0
    isl_die(isl_vec_get_ctx(vec1), isl_error_invalid,
327
5.83k
      "position out of range", return 0);
328
5.83k
  
return 5.83k
isl_int_cmp5.83k
(vec1->el[pos], vec2->el[pos]);
329
5.83k
}
330
331
isl_bool isl_vec_is_equal(__isl_keep isl_vec *vec1, __isl_keep isl_vec *vec2)
332
912
{
333
912
  if (
!vec1 || 912
!vec2912
)
334
0
    return isl_bool_error;
335
912
336
912
  
if (912
vec1->size != vec2->size912
)
337
0
    return isl_bool_false;
338
912
339
912
  return isl_seq_eq(vec1->el, vec2->el, vec1->size);
340
912
}
341
342
__isl_give isl_printer *isl_printer_print_vec(__isl_take isl_printer *printer,
343
  __isl_keep isl_vec *vec)
344
0
{
345
0
  int i;
346
0
347
0
  if (
!printer || 0
!vec0
)
348
0
    goto error;
349
0
350
0
  printer = isl_printer_print_str(printer, "[");
351
0
  for (i = 0; 
i < vec->size0
;
++i0
)
{0
352
0
    if (i)
353
0
      printer = isl_printer_print_str(printer, ",");
354
0
    printer = isl_printer_print_isl_int(printer, vec->el[i]);
355
0
  }
356
0
  printer = isl_printer_print_str(printer, "]");
357
0
358
0
  return printer;
359
0
error:
360
0
  isl_printer_free(printer);
361
0
  return NULL;
362
0
}
363
364
void isl_vec_dump(struct isl_vec *vec)
365
0
{
366
0
  isl_printer *printer;
367
0
368
0
  if (!vec)
369
0
    return;
370
0
371
0
  printer = isl_printer_to_file(vec->ctx, stderr);
372
0
  printer = isl_printer_print_vec(printer, vec);
373
0
  printer = isl_printer_end_line(printer);
374
0
375
0
  isl_printer_free(printer);
376
0
}
377
378
__isl_give isl_vec *isl_vec_set(__isl_take isl_vec *vec, isl_int v)
379
10
{
380
10
  vec = isl_vec_cow(vec);
381
10
  if (!vec)
382
0
    return NULL;
383
10
  isl_seq_set(vec->el, v, vec->size);
384
10
  return vec;
385
10
}
386
387
__isl_give isl_vec *isl_vec_set_si(__isl_take isl_vec *vec, int v)
388
1.51k
{
389
1.51k
  vec = isl_vec_cow(vec);
390
1.51k
  if (!vec)
391
0
    return NULL;
392
1.51k
  isl_seq_set_si(vec->el, v, vec->size);
393
1.51k
  return vec;
394
1.51k
}
395
396
/* Replace all elements of "vec" by "v".
397
 */
398
__isl_give isl_vec *isl_vec_set_val(__isl_take isl_vec *vec,
399
  __isl_take isl_val *v)
400
0
{
401
0
  vec = isl_vec_cow(vec);
402
0
  if (
!vec || 0
!v0
)
403
0
    goto error;
404
0
  
if (0
!isl_val_is_int(v)0
)
405
0
    isl_die(isl_val_get_ctx(v), isl_error_invalid,
406
0
      "expecting integer value", goto error);
407
0
  isl_seq_set(vec->el, v->n, vec->size);
408
0
  isl_val_free(v);
409
0
  return vec;
410
0
error:
411
0
  isl_vec_free(vec);
412
0
  isl_val_free(v);
413
0
  return NULL;
414
0
}
415
416
__isl_give isl_vec *isl_vec_clr(__isl_take isl_vec *vec)
417
4.10k
{
418
4.10k
  vec = isl_vec_cow(vec);
419
4.10k
  if (!vec)
420
0
    return NULL;
421
4.10k
  isl_seq_clr(vec->el, vec->size);
422
4.10k
  return vec;
423
4.10k
}
424
425
void isl_vec_lcm(struct isl_vec *vec, isl_int *lcm)
426
1.43k
{
427
1.43k
  isl_seq_lcm(vec->block.data, vec->size, lcm);
428
1.43k
}
429
430
/* Given a rational vector, with the denominator in the first element
431
 * of the vector, round up all coordinates.
432
 */
433
struct isl_vec *isl_vec_ceil(struct isl_vec *vec)
434
1.74k
{
435
1.74k
  vec = isl_vec_cow(vec);
436
1.74k
  if (!vec)
437
0
    return NULL;
438
1.74k
439
1.74k
  isl_seq_cdiv_q(vec->el + 1, vec->el + 1, vec->el[0], vec->size - 1);
440
1.74k
441
1.74k
  isl_int_set_si(vec->el[0], 1);
442
1.74k
443
1.74k
  return vec;
444
1.74k
}
445
446
struct isl_vec *isl_vec_normalize(struct isl_vec *vec)
447
167k
{
448
167k
  if (!vec)
449
0
    return NULL;
450
167k
  isl_seq_normalize(vec->ctx, vec->el, vec->size);
451
167k
  return vec;
452
167k
}
453
454
__isl_give isl_vec *isl_vec_neg(__isl_take isl_vec *vec)
455
0
{
456
0
  vec = isl_vec_cow(vec);
457
0
  if (!vec)
458
0
    return NULL;
459
0
  isl_seq_neg(vec->el, vec->el, vec->size);
460
0
  return vec;
461
0
}
462
463
__isl_give isl_vec *isl_vec_scale(__isl_take isl_vec *vec, isl_int m)
464
0
{
465
0
  if (isl_int_is_one(m))
466
0
    return vec;
467
0
  vec = isl_vec_cow(vec);
468
0
  if (!vec)
469
0
    return NULL;
470
0
  isl_seq_scale(vec->el, vec->el, m, vec->size);
471
0
  return vec;
472
0
}
473
474
/* Reduce the elements of "vec" modulo "m".
475
 */
476
__isl_give isl_vec *isl_vec_fdiv_r(__isl_take isl_vec *vec, isl_int m)
477
0
{
478
0
  vec = isl_vec_cow(vec);
479
0
  if (!vec)
480
0
    return NULL;
481
0
482
0
  isl_seq_fdiv_r(vec->el, vec->el, m, vec->size);
483
0
484
0
  return vec;
485
0
}
486
487
__isl_give isl_vec *isl_vec_add(__isl_take isl_vec *vec1,
488
  __isl_take isl_vec *vec2)
489
0
{
490
0
  vec1 = isl_vec_cow(vec1);
491
0
  if (
!vec1 || 0
!vec20
)
492
0
    goto error;
493
0
494
0
  
isl_assert0
(vec1->ctx, vec1->size == vec2->size, goto error);0
495
0
496
0
  isl_seq_combine(vec1->el, vec1->ctx->one, vec1->el,
497
0
      vec1->ctx->one, vec2->el, vec1->size);
498
0
  
499
0
  isl_vec_free(vec2);
500
0
  return vec1;
501
0
error:
502
0
  isl_vec_free(vec1);
503
0
  isl_vec_free(vec2);
504
0
  return NULL;
505
0
}
506
507
static int qsort_int_cmp(const void *p1, const void *p2)
508
0
{
509
0
  const isl_int *i1 = (const isl_int *) p1;
510
0
  const isl_int *i2 = (const isl_int *) p2;
511
0
512
0
  return isl_int_cmp(*i1, *i2);
513
0
}
514
515
__isl_give isl_vec *isl_vec_sort(__isl_take isl_vec *vec)
516
0
{
517
0
  if (!vec)
518
0
    return NULL;
519
0
  
520
0
  qsort(vec->el, vec->size, sizeof(*vec->el), &qsort_int_cmp);
521
0
522
0
  return vec;
523
0
}
524
525
__isl_give isl_vec *isl_vec_drop_els(__isl_take isl_vec *vec,
526
  unsigned pos, unsigned n)
527
23.3k
{
528
23.3k
  if (n == 0)
529
0
    return vec;
530
23.3k
  vec = isl_vec_cow(vec);
531
23.3k
  if (!vec)
532
0
    return NULL;
533
23.3k
534
23.3k
  
if (23.3k
pos + n > vec->size23.3k
)
535
0
    isl_die(vec->ctx, isl_error_invalid,
536
23.3k
      "range out of bounds", goto error);
537
23.3k
538
23.3k
  
if (23.3k
pos + n != vec->size23.3k
)
539
22.3k
    isl_seq_cpy(vec->el + pos, vec->el + pos + n,
540
22.3k
          vec->size - pos - n);
541
23.3k
542
23.3k
  vec->size -= n;
543
23.3k
  
544
23.3k
  return vec;
545
0
error:
546
0
  isl_vec_free(vec);
547
0
  return NULL;
548
23.3k
}
549
550
__isl_give isl_vec *isl_vec_insert_els(__isl_take isl_vec *vec,
551
  unsigned pos, unsigned n)
552
4.90k
{
553
4.90k
  isl_vec *ext = NULL;
554
4.90k
555
4.90k
  if (n == 0)
556
2
    return vec;
557
4.90k
  
if (4.90k
!vec4.90k
)
558
0
    return NULL;
559
4.90k
560
4.90k
  
if (4.90k
pos > vec->size4.90k
)
561
0
    isl_die(vec->ctx, isl_error_invalid,
562
4.90k
      "position out of bounds", goto error);
563
4.90k
564
4.90k
  ext =  isl_vec_alloc(vec->ctx, vec->size + n);
565
4.90k
  if (!ext)
566
0
    goto error;
567
4.90k
568
4.90k
  isl_seq_cpy(ext->el, vec->el, pos);
569
4.90k
  isl_seq_cpy(ext->el + pos + n, vec->el + pos, vec->size - pos);
570
4.90k
571
4.90k
  isl_vec_free(vec);
572
4.90k
  return ext;
573
0
error:
574
0
  isl_vec_free(vec);
575
0
  isl_vec_free(ext);
576
0
  return NULL;
577
4.90k
}
578
579
__isl_give isl_vec *isl_vec_insert_zero_els(__isl_take isl_vec *vec,
580
  unsigned pos, unsigned n)
581
4.88k
{
582
4.88k
  vec = isl_vec_insert_els(vec, pos, n);
583
4.88k
  if (!vec)
584
0
    return NULL;
585
4.88k
586
4.88k
  isl_seq_clr(vec->el + pos, n);
587
4.88k
588
4.88k
  return vec;
589
4.88k
}
590
591
/* Move the "n" elements starting as "src_pos" of "vec"
592
 * to "dst_pos".  The elements originally at "dst_pos" are moved
593
 * up or down depending on whether "dst_pos" is smaller or greater
594
 * than "src_pos".
595
 */
596
__isl_give isl_vec *isl_vec_move_els(__isl_take isl_vec *vec,
597
  unsigned dst_pos, unsigned src_pos, unsigned n)
598
0
{
599
0
  isl_vec *res;
600
0
601
0
  if (!vec)
602
0
    return NULL;
603
0
604
0
  
if (0
src_pos + n > vec->size0
)
605
0
    isl_die(vec->ctx, isl_error_invalid,
606
0
      "source range out of bounds", return isl_vec_free(vec));
607
0
  
if (0
dst_pos + n > vec->size0
)
608
0
    isl_die(vec->ctx, isl_error_invalid,
609
0
      "destination range out of bounds",
610
0
      return isl_vec_free(vec));
611
0
612
0
  
if (0
n == 0 || 0
dst_pos == src_pos0
)
613
0
    return vec;
614
0
615
0
  res = isl_vec_alloc(vec->ctx, vec->size);
616
0
  if (!res)
617
0
    return isl_vec_free(vec);
618
0
619
0
  
if (0
dst_pos < src_pos0
)
{0
620
0
    isl_seq_cpy(res->el, vec->el, dst_pos);
621
0
    isl_seq_cpy(res->el + dst_pos, vec->el + src_pos, n);
622
0
    isl_seq_cpy(res->el + dst_pos + n,
623
0
          vec->el + dst_pos, src_pos - dst_pos);
624
0
    isl_seq_cpy(res->el + src_pos + n,
625
0
          vec->el + src_pos + n, res->size - src_pos - n);
626
0
  } else {
627
0
    isl_seq_cpy(res->el, vec->el, src_pos);
628
0
    isl_seq_cpy(res->el + src_pos,
629
0
          vec->el + src_pos + n, dst_pos - src_pos);
630
0
    isl_seq_cpy(res->el + dst_pos, vec->el + src_pos, n);
631
0
    isl_seq_cpy(res->el + dst_pos + n,
632
0
          vec->el + dst_pos + n, res->size - dst_pos - n);
633
0
  }
634
0
635
0
  isl_vec_free(vec);
636
0
  return res;
637
0
}